Skip to content

Instantly share code, notes, and snippets.

@renatoassis01
Created March 7, 2016 12:35
Show Gist options
  • Save renatoassis01/72baaa848beacb5d788b to your computer and use it in GitHub Desktop.
Save renatoassis01/72baaa848beacb5d788b to your computer and use it in GitHub Desktop.
#!/bin/bash
NAME="app" # Name of the application
DJANGODIR=/webapps/app/ # Django project directory
USER=jonhdoe # the user to run as
GROUP=jonhdoe # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_WSGI_MODULE=app.wsgi # WSGI module name
echo "Starting $NAME"
# Activate the virtual environment
cd $DJANGODIR
source /webapps/app/env/bin/activate
export PYTHONPATH=$DJANGODIR:$PYTHONPATH
# Start your Django Unicorn
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
exec /webapps/app/env/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--log-level=debug \
--bind=127.0.0.1:8001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment