Last active
April 25, 2017 07:44
-
-
Save DmytroLitvinov/cd81954b1189fa7c62f866662c0a3fd8 to your computer and use it in GitHub Desktop.
[gunicorn_start example] Example file of gunicorn_start inside virtualenv #tags: gunicorn
This file contains 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 characters
#!/bin/bash | |
NAME="instagram_app_django" # Name of the application | |
DJANGODIR=/webapps/dillysocks/instagram-app-django/instagram-app # Django project directory | |
SOCKFILE=/webapps/dillysocks/instagram-app-django/run/gunicorn.sock # we will communicte using this unix socket | |
USER=dillysocks # 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=instagram_service.prod_settings # which settings file should Django use | |
DJANGO_WSGI_MODULE=instagram_service.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 \ | |
--log-level=debug \ | |
--log-file=- |
This file contains 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 characters
appdirs==1.4.3 | |
Django==1.10.5 | |
easy-thumbnails==2.3 | |
gunicorn==19.7.1 | |
olefile==0.44 | |
packaging==16.8 | |
Pillow==4.0.0 | |
pkg-resources==0.0.0 | |
psycopg2==2.7.1 | |
pyparsing==2.2.0 | |
requests==2.13.0 | |
six==1.10.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment