Commit 9a3def32 authored by Daniel STAN's avatar Daniel STAN

[django/gunicorn/init] passage à django-1.4

Et compat' avec le gunicorn correspondant: on passe donc désormais
par wsgi. Il faut donc aussi adapter l'initscript.
parent 9b5f6352
......@@ -16,13 +16,14 @@
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Green Unicorn WSGI server for Intranet"
NAME=gunicorn_django
NAME=gunicorn
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/gunicorn-intranet.pid
SOCKET=unix:/tmp/gunicorn-intranet.sock
SETTINGS="/usr/local/django/intranet/settings.py"
SETTINGS="wsgi:application"
DAEMON_ARGS="--workers=1 --pid=$PIDFILE --daemon --user=www-data --group=www-data --name=$NAME --bind=$SOCKET $SETTINGS"
SCRIPTNAME=/etc/init.d/$NAME
INTRANETDIR=/usr/local/django/intranet
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
......@@ -47,9 +48,9 @@ do_start()
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
start-stop-daemon -d $INTRANETDIR --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
start-stop-daemon -d $INTRANETDIR --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
......@@ -64,7 +65,7 @@ do_stop()
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
start-stop-daemon -d $INTRANETDIR --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
......@@ -73,7 +74,7 @@ do_stop()
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --pidfile $PIDFILE
start-stop-daemon -d $INTRANETDIR --stop --quiet --oknodo --retry=0/30/KILL/5 --pidfile $PIDFILE
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
#rm -f $PIDFILE
......@@ -84,7 +85,7 @@ do_stop()
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE
start-stop-daemon -d $INTRANETDIR --stop --signal 1 --quiet --pidfile $PIDFILE
return 0
}
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
# This application object is used by the development server
# as well as any WSGI server configured to use this file.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment