Skip to content

Instantly share code, notes, and snippets.

@johnjohndoe
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnjohndoe/62fbdf58608143507c94 to your computer and use it in GitHub Desktop.
Save johnjohndoe/62fbdf58608143507c94 to your computer and use it in GitHub Desktop.
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