Marek Kuziel - Deploying Django with Buildout

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites & 1 Group

    Marek Kuziel - Deploying Django with Buildout - Presentation Transcript

    1. Deploying Django with Buildout Marek Kuziel , Encode Ltd http://encode.net.nz/ [email_address]
    2. Why Django with Buildout?
      • Setting things up can be a real pain in the arse
      • Automation of a repeatable task
      • Having everything under control
      • Deployment strategy is be something a good developer should care about
      • You may find bugs/issues during the build process that you can patch and submit back to the community
      • 5 minutes to learn. Lifetime to master.
    3. Advantages
      • It's a repeatable task. Things get tested often .
      • Great way to deal with development , QA , staging , production
      • Standalone Python environment , good for security and developer's sanity ;-)
      • Great way to keep your project up-to-date
    4. How do we do things?
      • Non-system-wide Python. Compile Python by hand. Don't mess with system-wide site-packages
      • Development , QA , Production Buildout configs
      • Development , QA , Staging , Production , Mobile Django settings that load general settings.py
      • Build Django apps as Eggs. Makes deployment to production easier.
    5. Pre-requisities
      • Python
      • http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py
      • A terminal, because we'll do everything on a command line.
    6. Let's start
      • mkdir -p ~/projects/djangodemo
      • cd ~/projects/djangodemo/
      • note: all commands from now on are executed from ~/projects/djangodemo/ directory
      • wget http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py
      • or download http://encode.net.nz/m/django-with-buildout.tgz
    7. Basic Buildout config for Django
      • Create a new file called buildout.cfg
      [buildout] parts = django [django] recipe = djangorecipe version = 1.0
    8. Let's bootstrap ~/Python/2.5/bin/python bootstrap.py
      • running Python 2.5 compiled by hand. Located at ~/Python/2.5/
      • running Buildout's boostrap process with bootstrap.py
      Creating directory '/Users/marek/projects/djangodemo/bin'. Creating directory '/Users/marek/projects/djangodemo/parts'. Creating directory '/Users/marek/projects/djangodemo/eggs'. Creating directory '/Users/marek/projects/djangodemo/develop-eggs'. Generated script '/Users/marek/projects/djangodemo/bin/buildout'.
    9. Let's build ./bin/buildout Installing django. django: Downloading Django from: http://www.djangoproject.com/download/%s/tarball/ Generated script '/Users/marek/projects/djangodemo/bin/django'. ... and we're done!
    10. Separating development from production
      • Create a new file called development.cfg
      [buildout] extends = buildout.cfg parts += django-command-extensions eggs += Werkzeug [django] settings = development pythonpath += ${django-command-extensions:location} [django-command-extensions] recipe = infrae.subversion urls = http://django-command-extensions.googlecode.com/svn/trunk/ .
    11. Let's build again ./bin/buildout -c development.cfg Unused options for buildout: 'eggs'. Installing django-command-extensions. Installing django. Generated script '/Users/marek/projects/djangodemo/bin/django'. django: Skipping creating of project: project since it exists ... and we're almost done :)
    12. Adjusting settings
      • Copy INSTALLED_APPS from project/settings.py to project/development.py
      • Add 'extensions' at the end of INSTALLED_APPS tuple
      • By copying INSTALLED_APPS to development you keep the production INSTALLED_APPS in settings.py and make custom INSTALLED_APPS in development.py
    13. Time to start hacking, eh?
      • ./bin/django syncdb
      • ./bin/django startapp demo
      • ./bin/django runserver_plus
      Recommended reading: http://www.stereoplex.com/two-voices/a-django-development-environment-with-zc-buildout
    14. Thank you!

    + marekkuzielmarekkuziel, 11 months ago

    custom

    1001 views, 2 favs, 0 embeds more stats

    Slides from my presenation for NZPUG (http://nzpug. more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1001
      • 1001 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Groups / Events