What is the best way to run a django project on aws?

Question:

How should the project be deployed and run. There are loads of tools in this space. Which should be used and why?

  • Supervisor
  • Gunocorn
  • Ngnix
  • Fabric
  • Boto
  • Pip
  • Virtualenv
  • Load balancers

Answer:

It depends on your configuration. We are using the following stack for our environment on Rackspace, but you can setup the same thing on AWS with EC2 instances.

  • Ubuntu 11.04
  • Varnish (in memory cache) to avoid disk seeks
  • NginX to server static content
  • Apache to server dynamic content (MOD-WSGI)
  • Python 2.7.2 with Django
  • Jenkins for our continuous builds
  • GIT for version control
  • Fabric for the deployment.

So the way it works is that a GIT push to the origin repository is being polled by Jenkins. Jenkins then pulls the changes down from the origin. Builds a Python Egg, runs Unit tests, uses Fabric to deploy this egg to the environments necessary and reloads the Apache config to make sure the forked Apache processes are picking up the new Python egg.

Hope this helps.

Leave a Reply