Skip to content

Instantly share code, notes, and snippets.

@seanmavley
Last active August 29, 2015 14:23
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 seanmavley/68dab1db28c2ffd62ac8 to your computer and use it in GitHub Desktop.
Save seanmavley/68dab1db28c2ffd62ac8 to your computer and use it in GitHub Desktop.
Gunicorn Conf in 'The Trio'
description "Gunicorn daemon for Django project"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]
# If the process quits unexpectadly trigger a respawn
respawn
# by default DO has user django
setuid django
# here, you have this structure assuming you're logged via ssh
# in the user name of 'django'
# cd /home/noodles/Noodles/settings.py
# which means:
# /home/your_project_root/Your_project_folder/urls_settings_wsgi_directory
# You tell gunicorn to change to that Root directory, which contains your Project
chdir /home/noodles
# Now, lets land
exec gunicorn \
--name=Noodles \
--pythonpath=Noodles \
# This bind part, Take note. This bind address should:
# 1. Serve stuffs publicly via the 0.0.0.0 domain
# 2. The :9002 is referenced by nginx in the app_server
# block of code. take note
--bind=0.0.0.0:9002 \
--config /etc/gunicorn.d/gunicorn.py \
# this means:
# in the directory /home/noodles/
# look for a folder called Noodles/
# Look into the Noodles folder and find a file called
# wsgi
# In this wsgi file, run the function, 'application'
Noodles.wsgi:application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment