Last active
October 2, 2015 00:07
-
-
Save henocdz/76d51cba2175656f5889 to your computer and use it in GitHub Desktop.
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 characters
| #!/bin/bash | |
| NAME="project_name" | |
| DJANGODIR="/path/to/django_project" | |
| VIRTUAL_ENV_DIR="/path/to/virtualenv/folder" | |
| VIRTUAL_ENV_FILE=${DJANGODIR}/.env | |
| # SOCKFILE= | |
| ADDRESS=0.0.0.0:8000 | |
| USER=sysuser | |
| GROUP=sysgroup | |
| NUM_WORKERS=4 | |
| DJANGO_SETINGS_MODULE=${NAME}.settings.production | |
| DJANGO_WSGI_MODULE=${NAME}.wsgi | |
| GENERAL_LOG_FILE=/var/log/${NAME}/general.log | |
| ERROR_LOG_FILE=/var/log/${NAME}/error.log | |
| ACCESS_LOG_FILE=/var/log/${NAME}/access.log | |
| TIMEOUT=300 | |
| #Activate the virtual enviroment | |
| cd $DJANGODIR | |
| source ${VIRTUAL_ENV_DIR}/bin/activate | |
| source ${DJANGODIR}/.env | |
| #Start Django Unicorn | |
| exec ${VIRTUAL_ENV_DIR}/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \ | |
| --name $NAME \ | |
| --workers $NUM_WORKERS \ | |
| --user=$USER --group=$GROUP \ | |
| --log-level=info \ | |
| --bind=$ADDRESS \ | |
| --timeout=$TIMEOUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment