Last active
August 29, 2015 14:20
-
-
Save yoxyue/46e747e14366868f7ee7 to your computer and use it in GitHub Desktop.
gunicorn_flask_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 | |
NAME="www.abc.com" | |
FLASKDIR=/home/abc/site | |
VENVDIR=/home/abc/venv | |
SOCKFILE=/home/abc/sock | |
USER=captain | |
GROUP=captain | |
NUM_WORKERS=3 | |
echo "Starting $NAME" | |
# activate the virtualenv | |
cd $VENVDIR | |
source bin/activate | |
export PYTHONPATH=$FLASKDIR:$PYTHONPATH | |
#Create the run directory if it doesn't exist | |
RUNDIR=$(dirname $SOCKFILE) | |
test -d $RUNDIR || mkdir -p $RUNDIR | |
# Start you gunicorn | |
exec gunicorn hello:app -b 127.0.0.1:5000 \ | |
--name $NAME \ | |
--workers $NUM_WORKERS \ | |
--log-level=debug \ | |
--bind=unix:$SOCKFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment