Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I host a few Django sites on one of my Ubuntu servers. Up until recently I've been using the Cherokee HTTPd which has the option to launch back-end applications like Django sites but I've just switched out to nginx.

Under cherokee, I just "run" Django sites (sites are stored in /web/):

cd /web/mywebsite/; python runfcgi workdir=/web/mywebsite method=threaded socket=/web/mywebsite/sock pidfile=/web/mywebsite/pid maxspare=3 maxrequests=500

And then I'd connect to the socket at /web/mywebsite/sock. Cherokee also runs this as a user of my choice, in my case www-data.

This approach has worked well for me under Cherokee but now I'm moving to nginx, I don't have something there holding my hand for process management.

Looking around, there are literally hundreds of different ways of managing this. Init scripts, cron checks, daemontools. But as I'm on Ubuntu (and probably always will be) Upstart seems to make sense... But where do I start?

Could somebody give me an example of a upstart script that runs the above and will respawn it if it dies?

I have several django sites sitting in /web/ (and they're the only directories in that directory) so if there's a cheaty way that I can get this one upstart script to launch them all (with the same settings) and monitor them, that would be super-extra-awesome.

share|improve this question

I use same config, /etc/init/django.conf:

description "Django FastCGI /web site"

start on runlevel [2345]
stop on runlevel [!2345]

exec python /web/ runfcgi socket=//web/mywebsite/sock pidfile=/var/run/


start: start django or initctl start django
stop: stop django or initctl stop django
restart: restart django or initctl restart django

I recently recorded a video about configure nginx and django(fastcgi and upstart) -

But I prefer nginx and uwsgi(also upstart init script) - no link, i can post a maximum of one hyperlink.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.