DjangoCon 2011 – Real world Django deployment using Chef

After another great lunch (I din’t blog about it this time) we’ll be starting off the afternoons with Noah Kantrowitz and his talk on “Real world Django deployment using Chef”

Chef, a configuration management tool, is increasingly popular in the Django community. Many people have yet to take the plunge, and are still managing production systems exclusively through tools like Fabric or Buildout. In this talk I will quickly show the basics of building Chef recipes, both in general and a tour of the Django-and-Python-specific tools available. I will then walk through a suite of cookbooks built to deploy Packaginator as a production site in the cloud. If suitable wireless is available, I would like to do a live demonstration at the end, bringing up a new site from scratch.

You can find the slides for this presentation at

Updates Below:


Deploying multiple apps to clusters is as simple as copying code and running twice (obviously changing paths)


Chef doesn’t really worry about migrations. General feel is that you should run migrations after the deployment


Code from the talk can be found at


You can specify which servers you wan the code to execute on depending on it’s specific role.


database keyword allows you to specify your Django. It’ll also set up the Django file


Extremely easy to setup virtualenv, pip, django, supervisor, and gunicorn using pre-defined cookbooks


  • Cookbooks are collection of recipes
  • Environments are pegged cookbooks
  • Servers are Nodes
  • Data bags are JSON data


“Roles are a group of other Roles and Recipes”


You can extend recipes with Ruby.


Recipes can include other recipes
Included recipes are processed in order


“Recipes are collections of Resources”

Like manifests in Puppet


Resources take action through Providers

package "haproxy" {
yum install haproxy
apt-get install haproxy

Tries to find the optimal way to install on your given system


Resources all have:

  • Types
  • Names
  • Paramaters
  • Actions (enabled, start, install)
  • Can send notifications to other resources


How does Chef Work

  • Divided into Resources, Recipes and Roles
  • These are just text files that you can write in your own editor


n-Tier Infrastructure:

  • Provision Servers
  • Configure your Servers (Load Balancers, App Servers, DB Servers)
  • Integrate all of your servers


Infrastructure as Code: Building and managing infrastructure programmatically.


Noah taking the stage. Lets get this talk started.