Commit 02a5abed authored by Martin Lehoux's avatar Martin Lehoux

add gunicorn service script

parent cd823941
#!/bin/bash
NAME="nofist" #Name of the application (*)
DJANGODIR=/var/www/nofist-v2/nofistv2 # Django project directory (*)
SOCKFILE=/var/www/nofist-v2/run/gunicorn.sock # we will communicate using this unix socket (*)
USER=nofist # the user to run as (*)
GROUP=nofist # the group to run as (*)
NUM_WORKERS=1 # how many worker processes should Gunicorn spawn (*)
DJANGO_SETTINGS_MODULE=nofistv2.settings # which settings file should Django use (*)
DJANGO_WSGI_MODULE=nofistv2.wsgi # WSGI module name (*)
echo "Starting $NAME as `whoami`"
# Activate the virtual environment
# cd $DJANGODIR
# source /var/www/test/venv/bin/activate
# export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
# export PYTHONPATH=$DJANGODIR:$PYTHONPATH
# Create the run directory if it doesn't exist
RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR
# Start your Django Unicorn
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
exec gunicorn ${DJANGO_WSGI_MODULE}:core \
--name $NAME \
--workers $NUM_WORKERS \
--user $USER \
--bind=unix:$SOCKFILE
File mode changed from 100755 to 100644
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment