Last Updated: December 26, 2018
·
7.445K
· pilt

Run Django's runserver in supervisor

[program:runserver]
command=bin/python manage.py runserver
stopsignal=KILL
killasgroup=true

Without stopsignal=KILL and killasgroup=true (stopasgroup is available in 3.0a13) there will be an orphaned child process running after supervisorctl shutdown.

3 Responses
Add your response

Just an update here in case anyone stumbles upon this. If "killasgroup=true" doesn't work for you, try "stopasgroup=true". That's what I needed to get supervisor to properly stop the Django procs.

Thanks!

over 1 year ago ·

Another way is to run
manage.py runserver --noreload

Notice --noreload parameter, which cause Django run on the main thread (but won't reload when a file changes).
For production environments, you should use something more robust. Gunicorn is a great server, and you can run easliy:
gunicorn wsgi:application --bind 127.0.0.1:8000

over 1 year ago ·

stopasgroup=true works ok... thanks

over 1 year ago ·