Fixed #6163 -- Made "manage.py help runfcgi" display proper default values for the runfcgi options. Thanks to ash and Claude Paroz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17330 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1572a3d4b2
commit
ef5c873dba
|
@ -19,6 +19,25 @@ from django.utils import importlib
|
||||||
__version__ = "0.1"
|
__version__ = "0.1"
|
||||||
__all__ = ["runfastcgi"]
|
__all__ = ["runfastcgi"]
|
||||||
|
|
||||||
|
FASTCGI_OPTIONS = {
|
||||||
|
'protocol': 'fcgi',
|
||||||
|
'host': None,
|
||||||
|
'port': None,
|
||||||
|
'socket': None,
|
||||||
|
'method': 'fork',
|
||||||
|
'daemonize': None,
|
||||||
|
'workdir': '/',
|
||||||
|
'pidfile': None,
|
||||||
|
'maxspare': 5,
|
||||||
|
'minspare': 2,
|
||||||
|
'maxchildren': 50,
|
||||||
|
'maxrequests': 0,
|
||||||
|
'debug': None,
|
||||||
|
'outlog': None,
|
||||||
|
'errlog': None,
|
||||||
|
'umask': None,
|
||||||
|
}
|
||||||
|
|
||||||
FASTCGI_HELP = r"""
|
FASTCGI_HELP = r"""
|
||||||
Run this project as a fastcgi (or some other protocol supported
|
Run this project as a fastcgi (or some other protocol supported
|
||||||
by flup) application. To do this, the flup package from
|
by flup) application. To do this, the flup package from
|
||||||
|
@ -27,19 +46,19 @@ FASTCGI_HELP = r"""
|
||||||
runfcgi [options] [fcgi settings]
|
runfcgi [options] [fcgi settings]
|
||||||
|
|
||||||
Optional Fcgi settings: (setting=value)
|
Optional Fcgi settings: (setting=value)
|
||||||
protocol=PROTOCOL fcgi, scgi, ajp, ... (default fcgi)
|
protocol=PROTOCOL fcgi, scgi, ajp, ... (default %(protocol)s)
|
||||||
host=HOSTNAME hostname to listen on.
|
host=HOSTNAME hostname to listen on.
|
||||||
port=PORTNUM port to listen on.
|
port=PORTNUM port to listen on.
|
||||||
socket=FILE UNIX socket to listen on.
|
socket=FILE UNIX socket to listen on.
|
||||||
method=IMPL prefork or threaded (default prefork).
|
method=IMPL prefork or threaded (default %(method)s).
|
||||||
maxrequests=NUMBER number of requests a child handles before it is
|
maxrequests=NUMBER number of requests a child handles before it is
|
||||||
killed and a new child is forked (0 = no limit).
|
killed and a new child is forked (0 = no limit).
|
||||||
maxspare=NUMBER max number of spare processes / threads.
|
maxspare=NUMBER max number of spare processes / threads (default %(maxspare)s).
|
||||||
minspare=NUMBER min number of spare processes / threads.
|
minspare=NUMBER min number of spare processes / threads (default %(minspare)s).
|
||||||
maxchildren=NUMBER hard limit number of processes / threads.
|
maxchildren=NUMBER hard limit number of processes / threads (default %(maxchildren)s).
|
||||||
daemonize=BOOL whether to detach from terminal.
|
daemonize=BOOL whether to detach from terminal.
|
||||||
pidfile=FILE write the spawned process-id to this file.
|
pidfile=FILE write the spawned process-id to this file.
|
||||||
workdir=DIRECTORY change to this directory when daemonizing.
|
workdir=DIRECTORY change to this directory when daemonizing (default %(workdir)s).
|
||||||
debug=BOOL set to true to enable flup tracebacks.
|
debug=BOOL set to true to enable flup tracebacks.
|
||||||
outlog=FILE write stdout to this file.
|
outlog=FILE write stdout to this file.
|
||||||
errlog=FILE write stderr to this file.
|
errlog=FILE write stderr to this file.
|
||||||
|
@ -60,26 +79,7 @@ Examples:
|
||||||
$ manage.py runfcgi socket=/tmp/fcgi.sock method=prefork \
|
$ manage.py runfcgi socket=/tmp/fcgi.sock method=prefork \
|
||||||
daemonize=true pidfile=/var/run/django-fcgi.pid
|
daemonize=true pidfile=/var/run/django-fcgi.pid
|
||||||
|
|
||||||
"""
|
""" % FASTCGI_OPTIONS
|
||||||
|
|
||||||
FASTCGI_OPTIONS = {
|
|
||||||
'protocol': 'fcgi',
|
|
||||||
'host': None,
|
|
||||||
'port': None,
|
|
||||||
'socket': None,
|
|
||||||
'method': 'fork',
|
|
||||||
'daemonize': None,
|
|
||||||
'workdir': '/',
|
|
||||||
'pidfile': None,
|
|
||||||
'maxspare': 5,
|
|
||||||
'minspare': 2,
|
|
||||||
'maxchildren': 50,
|
|
||||||
'maxrequests': 0,
|
|
||||||
'debug': None,
|
|
||||||
'outlog': None,
|
|
||||||
'errlog': None,
|
|
||||||
'umask': None,
|
|
||||||
}
|
|
||||||
|
|
||||||
def fastcgi_help(message=None):
|
def fastcgi_help(message=None):
|
||||||
print FASTCGI_HELP
|
print FASTCGI_HELP
|
||||||
|
@ -127,14 +127,15 @@ def runfastcgi(argset=[], **kwargs):
|
||||||
'maxThreads': int(options["maxchildren"]),
|
'maxThreads': int(options["maxchildren"]),
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
return fastcgi_help("ERROR: Implementation must be one of prefork or thread.")
|
return fastcgi_help("ERROR: Implementation must be one of prefork or "
|
||||||
|
"thread.")
|
||||||
|
|
||||||
wsgi_opts['debug'] = options['debug'] is not None
|
wsgi_opts['debug'] = options['debug'] is not None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
module = importlib.import_module('.%s' % flup_module, 'flup')
|
module = importlib.import_module('.%s' % flup_module, 'flup')
|
||||||
WSGIServer = module.WSGIServer
|
WSGIServer = module.WSGIServer
|
||||||
except:
|
except Exception:
|
||||||
print "Can't import flup." + flup_module
|
print "Can't import flup." + flup_module
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -159,7 +160,8 @@ def runfastcgi(argset=[], **kwargs):
|
||||||
elif options["daemonize"].lower() in ('false', 'no', 'f'):
|
elif options["daemonize"].lower() in ('false', 'no', 'f'):
|
||||||
daemonize = False
|
daemonize = False
|
||||||
else:
|
else:
|
||||||
return fastcgi_help("ERROR: Invalid option for daemonize parameter.")
|
return fastcgi_help("ERROR: Invalid option for daemonize "
|
||||||
|
"parameter.")
|
||||||
|
|
||||||
daemon_kwargs = {}
|
daemon_kwargs = {}
|
||||||
if options['outlog']:
|
if options['outlog']:
|
||||||
|
|
Loading…
Reference in New Issue