Skip to content

Instantly share code, notes, and snippets.

@alexisbellido
Created February 13, 2013 14:45
Show Gist options
  • Save alexisbellido/4945061 to your computer and use it in GitHub Desktop.
Save alexisbellido/4945061 to your computer and use it in GitHub Desktop.
Run $ workon x_YourTango_SecretWeapon_development and then edit your ~/run-x_YourTango_SecretWeapon_development file with to look like this, notice the export lines.
#!/bin/bash -e
# this script may need to run with source to switch the virtualenv correctly, like this: $ source thisscript.sh
# gunicorn application has to be enabled in Django project
LOGFILE=/home/alexis/logs/yourtango_secret_weapon_development/gunicorn.log
LOGDIR=$(dirname $LOGFILE)
LOGLEVEL=debug
NUM_WORKERS=3
BIND_ADDRESS=127.0.0.1:8002
export DJANGO_SETTINGS_MODULE="YourTango_SecretWeapon.settings.development"
export YTSW_DATABASES_DEFAULT_NAME_DEVELOPMENT="ytsw_staging"
export YTSW_DATABASES_DEFAULT_USER_DEVELOPMENT="user_for_db"
export YTSW_DATABASES_DEFAULT_PASSWORD_DEVELOPMENT="pw_for_db"
export YTSW_DATABASES_DEFAULT_HOST_DEVELOPMENT="localhost"
export YTSW_DATABASES_DEFAULT_PORT_DEVELOPMENT="5433"
# user/group to run as
USER=alexis
GROUP=alexis
PROJECTDIR=/home/alexis/yourtango_secret_weapon_development
PROJECTENV=/home/alexis/.virtualenvs/x_YourTango_SecretWeapon_development
source $PROJECTENV/bin/activate
cd $PROJECTDIR
test -d $LOGDIR || mkdir -p $LOGDIR
exec python manage.py run_gunicorn --workers=$NUM_WORKERS --user=$USER --group=$GROUP --bind=$BIND_ADDRESS --log-level=$LOGLEVEL --log-file=$LOGFILE 2>>$LOGFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment