Changes between Version 1 and Version 2 of InitdScriptForDebian


Ignore:
Timestamp:
Aug 5, 2008, 10:50:19 AM (16 years ago)
Author:
Joost Cassee
Comment:

Read /etc/defaults/django. Other small changes.

Legend:

Unmodified
Added
Removed
Modified
  • InitdScriptForDebian

    v1 v2  
     1= Init script for Debian =
     2
     3This is an init script for Debian. Save as {{{/etc/init.d/django}}} and run the following command:
     4{{{
     5update-rc.d django defaults
     6}}}
     7
     8By default the script expects Django sites in {{{/var/lib/django/<project>}}}. It will store PID files in {{{/var/run/django}}}. These directories must already exist.
     9
     10The settings may be overridden in a settings file located at {{{/etc/defaults/django}}}. You must at least set the {{{DJANGO_SITES}}} variable. An example is included below.
     11
     12== {{{/etc/init.d/django}}} ==
     13
    114{{{
    215#! /bin/sh
     
    1023# Description:       Django, in order to operate with FastCGI, must be started
    1124#                    in a very specific way with manage.py. This must be done
    12 #                    for each DJango web server that has to run.
     25#                    for each Django web server that has to run.
    1326### END INIT INFO
    1427#
     
    1831# Changed: Jannis Leidel
    1932#          <jannis AT leidel.info>
     33#          Joost Cassee
     34#          <joost@cassee.net>
    2035#
    21 # Version: @(#)fastcgi 0.2 13-Jun-2007 jannis AT leidel.info
     36# Version: @(#)fastcgi 0.3 05-Aug-2008 joost AT cassee.net
    2237#
    2338
    24 #### SERVER SPECIFIC CONFIGURATION
     39set -e
     40
     41#### CONFIGURATION (override in /etc/default/django)
    2542
    2643# django project names/directories
    27 DJANGO_SITES="myapp myapp2 myapp3"
     44DJANGO_SITES=""
    2845
    2946# path to the directory with your django projects
    30 SITES_PATH=/path/to/django/projects
     47SITES_PATH=/var/lib/django
    3148
    3249# path to the directory for socket and pid files
    33 RUNFILES_PATH=$SITES_PATH/run
     50RUNFILES_PATH=/var/run/django
    3451
    3552# please make sure this is NOT root
     
    4158MAXREQUESTS=1000
    4259
    43 #### DO NOT CHANGE ANYTHING AFTER THIS LINE!
    44 set -e
     60#### END CONFIGURATION
     61
     62# Include defaults if available
     63if [ -f /etc/default/django ] ; then
     64    . /etc/default/django
     65fi
    4566
    4667PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    47 DESC="FastCGI servers"
     68DESC="Django FastCGI servers"
    4869NAME=$0
    4970SCRIPTNAME=/etc/init.d/$NAME
     
    125146
    126147}}}
     148
     149== {{{/etc/default/django}}} ==
     150
     151This is an example settings file. Most settings (apart from {{{DJANGO_SITES}}}) are not required, sane defaults are included in the script.
     152
     153{{{
     154# django project names/directories
     155DJANGO_SITES="myapp myapp2 myapp3"
     156
     157# path to the directory with your django projects
     158#SITES_PATH=/home/django/projects
     159
     160# path to the directory for socket and pid files
     161RUNFILES_PATH=$SITES_PATH/run
     162
     163# please make sure this is NOT root
     164# local user prefered, www-data accepted
     165RUN_AS=django
     166
     167# maximum requests before fast-cgi process respawns
     168# (a.k.a. get killed and let live)
     169MAXREQUESTS=100
     170}}}
Back to Top