Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Upstart configuration for Django / Gunicorn project
# Upstart configuration for Django project called "myapplication"
# ===============================================================
#
# Location: /etc/init/myapplication.conf
#
# Status: sudo service myapplication status
# Start: sudo service myapplication start
# Stop: sudo service myapplication stop
description "My application"
author "John Doe"
# When to start the service
start on runlevel [2345]
# When to stop the service
stop on runlevel [016]
# Automatically restart process if crashed
respawn
# Run as myapplication user
setuid myuser
setgid mygroup
# Current working directory
chdir /path/to/myapplication
# Start command
script
# Load virtualenv environment
. ../bin/activate
# Start webserver
exec gunicorn myapplication.wsgi:application --user=myuser --group=mygroup --bind 127.0.0.1:8007 --log-file=- --log-level DEBUG
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment