Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #6163 -- Made "manage.py help runfcgi" display proper default v…

…alues 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
  • Loading branch information...
commit ef5c873dbaddc2ac73a2e6c3d19bf1852a877a2e 1 parent 1572a3d
@jphalip jphalip authored
Showing with 31 additions and 29 deletions.
  1. +31 −29 django/core/servers/fastcgi.py
View
60 django/core/servers/fastcgi.py
@@ -19,6 +19,25 @@
__version__ = "0.1"
__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"""
Run this project as a fastcgi (or some other protocol supported
by flup) application. To do this, the flup package from
@@ -27,19 +46,19 @@
runfcgi [options] [fcgi settings]
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.
port=PORTNUM port 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
killed and a new child is forked (0 = no limit).
- maxspare=NUMBER max number of spare processes / threads.
- minspare=NUMBER min number of spare processes / threads.
- maxchildren=NUMBER hard limit number of processes / threads.
+ maxspare=NUMBER max number of spare processes / threads (default %(maxspare)s).
+ minspare=NUMBER min number of spare processes / threads (default %(minspare)s).
+ maxchildren=NUMBER hard limit number of processes / threads (default %(maxchildren)s).
daemonize=BOOL whether to detach from terminal.
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.
outlog=FILE write stdout to this file.
errlog=FILE write stderr to this file.
@@ -60,26 +79,7 @@
$ manage.py runfcgi socket=/tmp/fcgi.sock method=prefork \
daemonize=true pidfile=/var/run/django-fcgi.pid
-"""
-
-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_OPTIONS
def fastcgi_help(message=None):
print FASTCGI_HELP
@@ -127,14 +127,15 @@ def runfastcgi(argset=[], **kwargs):
'maxThreads': int(options["maxchildren"]),
}
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
try:
module = importlib.import_module('.%s' % flup_module, 'flup')
WSGIServer = module.WSGIServer
- except:
+ except Exception:
print "Can't import flup." + flup_module
return False
@@ -159,7 +160,8 @@ def runfastcgi(argset=[], **kwargs):
elif options["daemonize"].lower() in ('false', 'no', 'f'):
daemonize = False
else:
- return fastcgi_help("ERROR: Invalid option for daemonize parameter.")
+ return fastcgi_help("ERROR: Invalid option for daemonize "
+ "parameter.")
daemon_kwargs = {}
if options['outlog']:
Please sign in to comment.
Something went wrong with that request. Please try again.