[Python-modules-commits] r9200 - in packages/python-django/trunk/debian (5 files)
lamby at users.alioth.debian.org
lamby at users.alioth.debian.org
Wed Jul 29 09:29:44 UTC 2009
Date: Wednesday, July 29, 2009 @ 09:29:40
Author: lamby
Revision: 9200
Ship FastCGI initscript and /etc/default file in python-django's examples directory (Closes: #538863)
Added:
packages/python-django/trunk/debian/contrib/
packages/python-django/trunk/debian/contrib/default
packages/python-django/trunk/debian/contrib/initscript
packages/python-django/trunk/debian/python-django.examples
Modified:
packages/python-django/trunk/debian/changelog
Modified: packages/python-django/trunk/debian/changelog
===================================================================
--- packages/python-django/trunk/debian/changelog 2009-07-29 09:29:33 UTC (rev 9199)
+++ packages/python-django/trunk/debian/changelog 2009-07-29 09:29:40 UTC (rev 9200)
@@ -1,6 +1,8 @@
python-django (1.1-1) UNRELEASED; urgency=low
* New upstream release.
+ * Ship FastCGI initscript and /etc/default file in python-django's examples
+ directory (Closes: #538863)
-- Chris Lamb <lamby at debian.org> Wed, 29 Jul 2009 11:13:50 +0200
Added: packages/python-django/trunk/debian/contrib/default
===================================================================
--- packages/python-django/trunk/debian/contrib/default (rev 0)
+++ packages/python-django/trunk/debian/contrib/default 2009-07-29 09:29:40 UTC (rev 9200)
@@ -0,0 +1,16 @@
+# django project names/directories
+DJANGO_SITES="myapp myapp2 myapp3"
+
+# path to the directory with your django projects
+#SITES_PATH=/home/django/projects
+
+# path to the directory for socket and pid files
+RUNFILES_PATH=$SITES_PATH/run
+
+# please make sure this is NOT root
+# local user prefered, www-data accepted
+RUN_AS=django
+
+# maximum requests before fast-cgi process respawns
+# (a.k.a. get killed and let live)
+MAXREQUESTS=100
Added: packages/python-django/trunk/debian/contrib/initscript
===================================================================
--- packages/python-django/trunk/debian/contrib/initscript (rev 0)
+++ packages/python-django/trunk/debian/contrib/initscript 2009-07-29 09:29:40 UTC (rev 9200)
@@ -0,0 +1,131 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: FastCGI servers for Django
+# Required-Start: networking
+# Required-Stop: networking
+# Default-Start: 2 3 4 5
+# Default-Stop: S 0 1 6
+# Short-Description: Start FastCGI servers with Django.
+# Description: Django, in order to operate with FastCGI, must be started
+# in a very specific way with manage.py. This must be done
+# for each Django web server that has to run.
+### END INIT INFO
+#
+# Author: Guillermo Fernandez Castellanos
+# <guillermo.fernandez.castellanos AT gmail.com>.
+#
+# Changed: Jannis Leidel
+# <jannis AT leidel.info>
+# Joost Cassee
+# <joost at cassee.net>
+#
+# Version: @(#)fastcgi 0.3 05-Aug-2008 joost AT cassee.net
+#
+
+set -e
+
+#### CONFIGURATION (override in /etc/default/django)
+
+# django project names/directories
+DJANGO_SITES=""
+
+# path to the directory with your django projects
+SITES_PATH=/var/lib/django
+
+# path to the directory for socket and pid files
+RUNFILES_PATH=/var/run/django
+
+# please make sure this is NOT root
+# local user prefered, www-data accepted
+RUN_AS=www-data
+
+# maximum requests before fast-cgi process respawns
+# (a.k.a. get killed and let live)
+MAXREQUESTS=1000
+
+#### END CONFIGURATION
+
+# Include defaults if available
+if [ -f /etc/default/django ] ; then
+ . /etc/default/django
+fi
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DESC="Django FastCGI servers"
+NAME=$0
+SCRIPTNAME=/etc/init.d/$NAME
+mkdir -p $RUNFILES_PATH
+chown -R $RUN_AS:$RUN_AS $RUNFILES_PATH
+
+#
+# Function that starts the daemon/service.
+#
+d_start()
+{
+ # Starting all Django FastCGI processes
+ # PORT=$PORT_START
+ for SITE in $DJANGO_SITES
+ do
+ echo -n ", $SITE"
+ if [ -f $RUNFILES_PATH/$SITE.pid ]; then
+ echo -n " already running"
+ else
+ start-stop-daemon --start --quiet \
+ --pidfile $RUNFILES_PATH/$SITE.pid \
+ --chuid $RUN_AS --exec /usr/bin/env -- python \
+ $SITES_PATH/$SITE/manage.py runfcgi \
+ protocol=fcgi method=threaded maxrequests=$MAXREQUESTS \
+ socket=$RUNFILES_PATH/$SITE.socket \
+ pidfile=$RUNFILES_PATH/$SITE.pid
+ chmod 400 $RUNFILES_PATH/$SITE.pid
+ fi
+ sleep 1
+ done
+}
+
+#
+# Function that stops the daemon/service.
+#
+d_stop() {
+ # Killing all Django FastCGI processes running
+ for SITE in $DJANGO_SITES
+ do
+ echo -n ", $SITE"
+ start-stop-daemon --stop --quiet --pidfile $RUNFILES_PATH/$SITE.pid \
+ || echo -n " not running"
+ if [ -f $RUNFILES_PATH/$SITE.pid ]; then
+ rm -f $RUNFILES_PATH/$SITE.pid
+ fi
+ sleep 1
+ done
+}
+
+ACTION="$1"
+case "$ACTION" in
+ start)
+ echo -n "Starting $DESC: $NAME"
+ d_start
+ echo "."
+ ;;
+
+ stop)
+ echo -n "Stopping $DESC: $NAME"
+ d_stop
+ echo "."
+ ;;
+
+ restart|force-reload)
+ echo -n "Restarting $DESC: $NAME"
+ d_stop
+ sleep 2
+ d_start
+ echo "."
+ ;;
+
+ *)
+ echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+exit 0
Added: packages/python-django/trunk/debian/python-django.examples
===================================================================
--- packages/python-django/trunk/debian/python-django.examples (rev 0)
+++ packages/python-django/trunk/debian/python-django.examples 2009-07-29 09:29:40 UTC (rev 9200)
@@ -0,0 +1 @@
+debian/contrib/*
More information about the Python-modules-commits
mailing list