Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- NAME="spellplay" # Name of the application
- DJANGODIR=/webapps/djangouser/DjangoProjects/SpellPlay-Server/spellplay # Django project directory
- SOCKFILE=/webapps/djangouser/run/gunicorn.sock # we will communicte using this unix socket (Not in this case. Here bind to IP)
- VIRTUALENVDIR=/webapps/djangouser/virtualenv # Directory for virtual environment
- USER=djangouser # 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=spellplay.settings # which settings file should Django use
- DJANGO_WSGI_MODULE=spellplay.wsgi # WSGI module name
- SERVERIP=45.55.133.118:8010 # Server IP to be used to bind to gunicorn
- echo "Starting $NAME as `whoami`"
- # Activate the virtual environment
- cd $VIRTUALENVDIR
- source bin/activate
- cd $DJANGODIR
- 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
- cd $DJANGODIR
- cd ..
- # Start your Django Unicorn
- # Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
- exec gunicorn ${DJANGO_WSGI_MODULE}:application \
- --name $NAME \
- --workers $NUM_WORKERS \
- --user=$USER --group=$GROUP \
- --bind=$SERVERIP \
- --log-level=debug \
- --log-file=-
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement