Skip to content

Commit 43e0649

Browse files
author
liangliangyy
committed
添加配置
1 parent 239ae8a commit 43e0649

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

bin/django_start

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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=-

0 commit comments

Comments
 (0)