Advertisement
Guest User

Untitled

a guest
Aug 30th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. NAME="spellplay" # Name of the application
  4. DJANGODIR=/webapps/djangouser/DjangoProjects/SpellPlay-Server/spellplay # Django project directory
  5. SOCKFILE=/webapps/djangouser/run/gunicorn.sock # we will communicte using this unix socket (Not in this case. Here bind to IP)
  6. VIRTUALENVDIR=/webapps/djangouser/virtualenv # Directory for virtual environment
  7. USER=djangouser # the user to run as
  8. GROUP=webapps # the group to run as
  9. NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
  10. DJANGO_SETTINGS_MODULE=spellplay.settings # which settings file should Django use
  11. DJANGO_WSGI_MODULE=spellplay.wsgi # WSGI module name
  12. SERVERIP=45.55.133.118:8010 # Server IP to be used to bind to gunicorn
  13.  
  14. echo "Starting $NAME as `whoami`"
  15.  
  16. # Activate the virtual environment
  17. cd $VIRTUALENVDIR
  18. source bin/activate
  19.  
  20. cd $DJANGODIR
  21. export DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE}
  22. export PYTHONPATH=$DJANGODIR:$PYTHONPATH
  23.  
  24. # Create the run directory if it doesn't exist
  25. RUNDIR=$(dirname $SOCKFILE)
  26. test -d $RUNDIR || mkdir -p $RUNDIR
  27.  
  28. cd $DJANGODIR
  29. cd ..
  30. # Start your Django Unicorn
  31. # Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
  32. exec gunicorn ${DJANGO_WSGI_MODULE}:application \
  33. --name $NAME \
  34. --workers $NUM_WORKERS \
  35. --user=$USER --group=$GROUP \
  36. --bind=$SERVERIP \
  37. --log-level=debug \
  38. --log-file=-
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement