Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Solid Python Deployments for Everybody

Solid Python Deployments for Everybody

Without orientation, deployments of Python applications can be tiresome and even painful. This talk attempts to replace anxiety and pain through informed annoyance.

There are extensive additional notes to this talk at http://hynek.me/talks/python-deployments/ .

Hynek Schlawack

March 16, 2013
Tweet

More Decks by Hynek Schlawack

Other Decks in Programming

Transcript

  1. ?

  2. No!

  3. “Python 2.4 is not supported. It came out 8 years

    ago. That's older than Youtube. Upgrade.” — Kenneth Reitz
  4. Use virtualen $ virtualenv venv; . venv/bin/activate $ pip install

    pyramid requests $ py.test … $ pip freeze >requirements.txt … $ pip install -r requirements.txt
  5. 1. check out from VCS 2. create virtualenv 3. install

    dependencies 4. do whatever you want 5. package result 6. push to your repo
  6. from … import Deployment def deb(branch=None): deploy = Deployment( 'whois',

    build_deps=['libpq-dev',], run_deps=['libpq5',]) deploy.prepare_app( branch=branch) deploy.build_deb()
  7. prise-oriented features to to compare the two pet Open ource

    Puppet Enterprise ✔ ✔ ✔ Not easy at all. Solution
  8. r t

  9. Example: upstart $ cat /etc/init/yourapp.conf start on static-network-up stop on

    deconfiguring-networking respawn chdir /path/to/yourapp setuid yourapp exec /path/to/gunicorn_django settings.py $ start yourapp
  10. $ cat settings.py … INSTALLED_APPS = ( … "gunicorn", )

    … $ manage.py run_gunicorn Easy t Set U : gunicorn
  11. Easy t Set U : nginx location / { proxy_pass

    http://127.0.0.1:5000; } location /static/ { root /your/app/public/; }