File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ NAME=" djangoblog" # Name of the application
4
+ DJANGODIR=//var/www/DjangoBlog # Django project directory
5
+ SOCKFILE=/var/www/DjangoBlog/run/gunicorn.sock # we will communicte using this unix socket
6
+ USER=root # the user to run as
7
+ GROUP=root # the group to run as
8
+ NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
9
+ DJANGO_SETTINGS_MODULE=DjangoBlog.settings # which settings file should Django use
10
+ DJANGO_WSGI_MODULE=DjangoBlog.wsgi # WSGI module name
11
+
12
+ echo " Starting $NAME as ` whoami` "
13
+
14
+ # Activate the virtual environment
15
+ cd $DJANGODIR
16
+ source /root/dev/python3/bin/activate
17
+ export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
18
+ export PYTHONPATH=$DJANGODIR :$PYTHONPATH
19
+
20
+ # Create the run directory if it doesn't exist
21
+ RUNDIR=$( dirname $SOCKFILE )
22
+ test -d $RUNDIR || mkdir -p $RUNDIR
23
+
24
+ # Start your Django Unicorn
25
+ # Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
26
+ exec /root/dev/python3/bin/gunicorn ${DJANGO_WSGI_MODULE} :application \
27
+ --name $NAME \
28
+ --workers $NUM_WORKERS \
29
+ --user=$USER --group=$GROUP \
30
+ --bind=unix:$SOCKFILE \
31
+ --log-level=debug \
32
+ --log-file=-
You can’t perform that action at this time.
0 commit comments