Created
September 3, 2015 11:06
-
-
Save thunder-spb/42b41faeb4a2f1dc08c7 to your computer and use it in GitHub Desktop.
Revisions
-
thunder-spb created this gist
Sep 3, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ #!/bin/bash NAME="app_newretail" # Name of the application DJANGODIR=/data/webapps/python/newretail/${NAME} # Django project directory SOCKFILE=/data/webapps/python/newretail/run/gunicorn.sock # we will communicte using this unix socket USER=py_webapps # the user to run as GROUP=webapps # the group to run as NUM_WORKERS=3 # how many worker processes should Gunicorn spawn DJANGO_SETTINGS_MODULE=${NAME}.settings # which settings file should Django use DJANGO_WSGI_MODULE=${NAME}.wsgi # WSGI module name echo "Starting $NAME as `whoami`" # Activate the virtual environment cd $DJANGODIR source ../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 ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \ --name $NAME \ --workers $NUM_WORKERS \ --user=$USER --group=$GROUP \ --bind=unix:$SOCKFILE \ --reload \ --timeout=300 \ --log-level=info \ --log-file=-