Changes between Version 3 and Version 4 of InitdScriptForDebian


Ignore:
Timestamp:
Apr 23, 2010, 4:47:43 AM (15 years ago)
Author:
Sebastian Rahlf
Comment:

New version supporting virtualenv.

Legend:

Unmodified
Added
Removed
Modified
  • InitdScriptForDebian

    v3 v4  
    99
    1010The 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
     12You can also have sites run in their own [http://pypi.python.org/pypi/virtualenv virtualenv] by creating one with the same name as the Django site in {{{/var/run/django/environments}}}.
    1113
    1214== {{{/etc/init.d/django}}} ==
     
    3638#          <basti AT redtoad.de>
    3739#
    38 # Version: @(#)fastcgi 0.4 28-Jul-2009 basti AT redtoad.de
     40# Version: @(#)fastcgi 0.5 19-Nov-2009 basti AT redtoad.de
    3941#
    4042
     
    4850# path to the directory with your django projects
    4951SITES_PATH=/var/lib/django
     52
     53# path to the directory conrtaining all site-specific virtualenvs
     54# (see http://pypi.python.org/pypi/virtualenv for more information)
     55ENVIRONMENT_PATH=$SITES_PATH/environment
    5056
    5157# path to the directory for socket and pid files
     
    8692{
    8793    # Starting all Django FastCGI processes
    88     # PORT=$PORT_START
    8994    for SITE in $DJANGO_SITES
    9095    do
    9196        echo -n " $SITE"
     97       
     98        # find python binary to use     
     99        if [ -f $ENVIRONMENT_PATH/$SITE/bin/python ]; then
     100           PYTHON=$ENVIRONMENT_PATH/$SITE/bin/python
     101        else
     102           PYTHON=`which python`
     103        fi
     104
    92105        if [ -f $RUNFILES_PATH/$SITE.pid ]; then
    93106            echo -n " already running"
     
    95108            start-stop-daemon --start --quiet \
    96109                       --pidfile $RUNFILES_PATH/$SITE.pid \
    97                        --chuid $RUN_AS --exec /usr/bin/env -- python \
     110                       --chuid $RUN_AS --exec /usr/bin/env -- $PYTHON \
    98111                       $SITES_PATH/$SITE/manage.py runfcgi \
    99112                       protocol=fcgi method=threaded maxrequests=$MAXREQUESTS \
     
    179192#SITES_PATH=/home/django/projects
    180193
     194# path to the directory conrtaining all site-specific virtualenvs
     195# (see http://pypi.python.org/pypi/virtualenv for more information)
     196ENVIRONMENT_PATH=$SITES_PATH/environment
     197
    181198# path to the directory for socket and pid files
    182199RUNFILES_PATH=$SITES_PATH/run
Back to Top