-
-
Save RamsesMartinez/55e005f664a9f258b283d12b963baed0 to your computer and use it in GitHub Desktop.
gunicorn start to run a django app
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 | |
# This runs on 9000 port | |
NAME="appname" | |
VIRTUALENV="virtualenv folder" | |
DJANGO_DIR="django root folder" | |
USER=root | |
GROUP=sudo | |
NUM_WORKERS=5 | |
DJANGO_WSGI_MODULE=<wsgi module> | |
echo "Starting $NAME as `whoami`" | |
cd $VIRTUALENV | |
source bin/activate | |
cd $DJANGO_DIR | |
# Enviroment variables | |
export DJANGO_SETTINGS_MODULE=<django settings module> | |
export PYTHONPATH=$DJANGO_DIR:$PYTHONPATH | |
exec gunicorn ${DJANGO_WSGI_MODULE} \ | |
--workers $NUM_WORKERS \ | |
--bind=127.0.0.1:9000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment