Django - Using Upstart to run Django built-in dev server

Sometimes, You only want to have a small django server to run a not-important-app, and you dont want to install any extra stuff. So, my solution is just use the Django built-in development app and make it start as a service at startup with Upstart (in Ubuntu).

Here is how:

1. Create a bash script to start django dev server


. ~/.venv/myvirtualenv/bin/activate
cd /var/www/MyDjangoProject
./ runserver

2. Create a file name django.conf in /etc/init/

# django - start django server#

description     "start django server"

start on startup       
stop on shutdown    


exec /var/www/MyDjangoProject/

3. Create a symlink of upstart-job in /etc/init.d/

ln -s /lib/init/upstart-job /etc/init.d/django

 4. Start the job

$sudo start django

By this way, we will not see the output messages of the Django dev server. That's cool!

Read the Upstart cookbook for more understanding: