Created
July 15, 2013 10:54
-
-
Save terryoy/5999141 to your computer and use it in GitHub Desktop.
start django server script with gunicorn
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 | |
set -e | |
LOGFILE=/var/log/apps/djangostart/console.log | |
LOGDIR=$(dirname $LOGFILE) | |
NUM_WORKERS=3 | |
# user/group to run as | |
USER=ubuntu | |
GROUP=ubuntu | |
cd /home/ubuntu/apps/djangostart/ | |
# setup | |
WORKON_HOME=$HOME/.virtualenvs | |
ENV_NAME=djangoenv | |
#source virtualenvwrapper.sh | |
#workon $ENV_NAME | |
source $WORKON_HOME/$ENV_NAME/bin/activate | |
test -d $LOGDIR || mkdir -p $LOGDIR | |
exec gunicorn_django -w $NUM_WORKERS \ | |
--user=$USER --group=$GROUP --log-level=debug \ | |
--log-file=$LOGFILE 2>>$LOGFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment