This is code and configuration for my Django Deployment Workshop.
Here you'll find example config used to set up an example deployment environment for a Python WSGI stack, including:
- A Django site deployed with Pip, Virtualenv, and Fabric.
- Apache/mod_wsgi and Gunicorn application servers.
- Nginx load balancers and media servers.
- Memcached.
- PostgreSQL with pgpool
I've made comments and notes where possible, but it's entirely possible that this won't make a whole lot of sense without actually taking the class. But this is all BSD-licensed, so please feel free to use it as a starting point for you own deployments.
The Django site used for the examples is Kevin Fricovsky's Mingus, a blog application built on a bunch existing reusable apps.
See Mingus's INSTALL doc for the basics of getting Mingus running. If you're
on a VM or remote server remember that you'll have to runserver 0.0.0.0:8000
to get Django listening on public IP interfaces.
After than, start deploying. My script for the install is in notes
; be sure to follow along with the most recent one (PyCon 2011 as of this writing).
The other scripts are there for posterity.
If you're not using Ubuntu 10.04 LTS then YMMV.
By my count this three-hour class covers about a dozen different pieces of technology. Below are some links to documentation of these various bits. If you read through all of it until you understand every command and configuration option I've used, you'll be well on your way towards groking this stuff. Good luck!
- Ubuntu.
- git (also see the git book).
- Pip.
- Virtualenv.
- Django; see particularly the settings reference.
- Apache; the directive quick reference is especially useful.
- Gunicorn
- PostgreSQL docs, including:
- Server configuration (
postgresql.conf
).- Client authentication (
pg_hba.conf
).- Fabric.
- Nginx, specifically the upstream and proxy modules.
- memcached.
- Django's caching framework.
- pgpool2.
- Chef, specifically Chef Solo.