Skip to content

Instantly share code, notes, and snippets.

@terryoy
Created July 15, 2013 10:54
Show Gist options
  • Save terryoy/5999141 to your computer and use it in GitHub Desktop.
Save terryoy/5999141 to your computer and use it in GitHub Desktop.
start django server script with gunicorn
#!/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