12345678910111213141516171819202122232425262728293031 |
- #!/bin/bash
- NAME="AhPestDjangoWeb" # Name of the application
- DJANGODIR=/code/AhPestDjangoWeb # Django project directory
- SOCKFILE=/code/AhPestDjangoWeb/run/gunicorn.sock # we will communicte using this unix socket
- USER=root # the user to run as
- GROUP=root # the group to run as
- NUM_WORKERS=1 # how many worker processes should Gunicorn spawn
- DJANGO_SETTINGS_MODULE=AhPestDjangoWeb.settings # which settings file should Django use
- DJANGO_WSGI_MODULE=AhPestDjangoWeb.wsgi # WSGI module name
- echo "Starting $NAME as `whoami`"
- # Activate the virtual environment
- cd $DJANGODIR
- export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
- export PYTHONPATH=$DJANGODIR:$PYTHONPATH
- python manage.py makemigrations
- python manage.py migrate
- python manage.py collectstatic
- # Start your Django Unicorn
- # Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
- exec gunicorn ${DJANGO_WSGI_MODULE}:application \
- --name $NAME \
- --workers $NUM_WORKERS \
- --user=$USER --group=$GROUP \
- --bind=unix:$SOCKFILE \
- --log-level=debug \
- --log-file=-
|