-
Notifications
You must be signed in to change notification settings - Fork 4
/
invoke.in
77 lines (65 loc) · 1.71 KB
/
invoke.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh
set -e
TOPDIR=@TOPDIR@
PIDFILE=$TOPDIR/gunicorn.pid
WSGI=@WSGI@
DATABASE_URL=@DATABASE_URL@
DJANGO_DEBUG=false
DJANGO_LIVE=true
LISTEN_PORT=@PORT@
ALLOWED_HOSTS='@ALLOWED_HOSTS@'
DJANGO_SECRET_KEY=@DJANGO_SECRET_KEY@
EMAILS_LIVE=true
EMAILS_SMTP_HOST=localhost
EMAILS_SMTP_PORT=25
MEDIA_ROOT=$TOPDIR/media
export DATABASE_URL DJANGO_DEBUG ALLOWED_HOSTS DJANGO_SECRET_KEY EMAILS_LIVE EM\
AILS_SMTP_HOST EMAILS_SMTP_PORT DJANGO_LIVE MEDIA_ROOT
gunicorn_start() {
ENV/bin/gunicorn -b 127.0.0.1:$LISTEN_PORT -w 3 -k gevent --max-requests 250 --daemon --pid $PIDFILE --error-logfile $TOPDIR/gunicorn-errors.log --chdir $TOPDIR/releases/current $WSGI
}
gunicorn_stop() {
[ -f "$PIDFILE" ] || exit 1
kill -INT `cat "$PIDFILE"`
}
shell() {
ENV/bin/python manage.py shell
}
migrate() {
ENV/bin/python manage.py migrate
}
collectstatic() {
ENV/bin/python manage.py collectstatic --noinput
}
compilemessages() {
if test -d locale; then
ENV/bin/python manage.py compilemessages
fi
}
case $1 in
start)
cd $TOPDIR/releases/current
gunicorn_start ;;
stop)
cd $TOPDIR/releases/current
gunicorn_stop ;;
restart|reload)
cd $TOPDIR/releases/current
gunicorn_stop
gunicorn_start ;;
shell)
cd $TOPDIR/releases/current
shell ;;
prep)
cd $TOPDIR/releases/next
compilemessages
collectstatic
migrate ;;
import)
shift
$TOPDIR/releases/currentENV/bin/python $TOPDIR/releases/currentmanage.py import_pages $* ;;
*)
cd $TOPDIR/releases/current
ENV/bin/python manage.py $* ;;
esac
exit 0