Typically, setting up a Django application server involves coupling Django with apache via mod_wsgi. However, in my case I prefer nginx which has mature support for the FastCGI protocol. The trouble is that Django does not by default come with FastCGI support. This can be easily fixed by installing flup, which allows you to start FastCGI processes on the command line using Django project's manage.py. However, this leaves the question of how to properly background the FastCGI processes and even more importantly, how to start them up if the server is rebooted. I searched for a solution and not much came up, so I wrote a script that I called flint.

flint works with Django and virtualenv. You tell it where you store your Django projects and virtual environments and it can look there to start up FastCGI processes for each project. Typical usage:

$ flint start_all or $ flint start myproject

This takes care of the first concern: properly backgrounding the FastCGI processes. The second concern: starting all of this up on server startup is handled by an init.d script (currently only for Debian/Ubuntu systems), which essentially runs flint start_all and flint stop_all on startup and shutdown respectively.

You can obtain flint in two ways:

  • Via git at github. You can just use the flint executable directly since it's just a shell script, or you can build it using debuild on a suitable Debian system.
  • As a deb package.