Last active
June 3, 2019 06:11
-
-
Save rub1cc/5834e43cfac8a656af01f0614f36afdb 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
NAME="project_name" # Name of Django application | |
DJANGODIR=path_to_project # Django project directory | |
SOCKFILE=127.0.0.1:8000 # we will communicate using this unix socket | |
USER=user # The user to run as | |
GROUP=user # 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 | |
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE | |
export PYTHONPATH=$DJANGODIR:$PYTHONPATH | |
# Start your Django Unicorn | |
pipenv run gunicorn ${DJANGO_WSGI_MODULE}:application \ | |
--name $NAME \ | |
--workers $NUM_WORKERS \ | |
--user $USER \ | |
--bind=$SOCKFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment