Documented options accepted by the runfcgi management command.

Also, modified our custom management command option docs xref parser
to also process those without a ``--`` prefix. --  Refs #14398.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14361 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ramiro Morales 2010-10-27 15:35:07 +00:00
parent 0b39bf02b9
commit 4239bb0f35
3 changed files with 133 additions and 10 deletions

View File

@ -2,6 +2,7 @@
Sphinx plugins for Django documentation.
"""
import os
import re
from docutils import nodes, transforms
try:
@ -21,6 +22,9 @@ from sphinx.writers.html import SmartyPantsHTMLTranslator
from sphinx.util.console import bold
from sphinx.util.compat import Directive
# RE for option descriptions without a '--' prefix
simple_option_desc_re = re.compile(
r'([-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)')
def setup(app):
app.add_crossref_type(
@ -207,6 +211,16 @@ def parse_django_adminopt_node(env, sig, signode):
if not count:
firstname = optname
count += 1
if not count:
for m in simple_option_desc_re.finditer(sig):
optname, args = m.groups()
if count:
signode += addnodes.desc_addname(', ', ', ')
signode += addnodes.desc_name(optname, optname)
signode += addnodes.desc_addname(args, args)
if not count:
firstname = optname
count += 1
if not firstname:
raise ValueError
return firstname

View File

@ -79,19 +79,19 @@ your :doc:`manage.py </ref/django-admin>` is), and then run the
If you specify ``help`` as the only option after :djadmin:`runfcgi`, it'll
display a list of all the available options.
You'll need to specify either a ``socket``, a ``protocol`` or both ``host`` and
``port``. Then, when you set up your Web server, you'll just need to point it at
the host/port or socket you specified when starting the FastCGI server. See the
examples_, below.
You'll need to specify either a :djadminopt:`socket`, a :djadminopt:`protocol`
or both :djadminopt:`host` and :djadminopt:`port`. Then, when you set up your
Web server, you'll just need to point it at the host/port or socket you
specified when starting the FastCGI server. See the examples_, below.
Protocols
---------
Django supports all the protocols that flup_ does, namely fastcgi_, `SCGI`_ and
`AJP1.3`_ (the Apache JServ Protocol, version 1.3). Select your preferred
protocol by using the ``protocol=<protocol_name>`` option with ``./manage.py
runfcgi`` -- where ``<protocol_name>`` may be one of: ``fcgi`` (the default),
``scgi`` or ``ajp``. For example::
protocol by using the :djadminopt:`protocol=\<protocol_name\> <protocol>` option
with ``./manage.py runfcgi`` -- where ``<protocol_name>`` may be one of:
``fcgi`` (the default), ``scgi`` or ``ajp``. For example::
./manage.py runfcgi protocol=scgi
@ -131,8 +131,8 @@ Simply hitting ``Ctrl-C`` will stop and quit the FastCGI server. However, when
you're dealing with background processes, you'll need to resort to the Unix
``kill`` command.
If you specify the ``pidfile`` option to :djadmin:`runfcgi`, you can kill the
running FastCGI daemon like this::
If you specify the :djadminopt:`pidfile` option to :djadmin:`runfcgi`, you can
kill the running FastCGI daemon like this::
kill `cat $PIDFILE`
@ -389,7 +389,7 @@ prefix automatically.
In the cases where Django cannot work out the prefix correctly and where you
want the original value to be used in URLs, you can set the
``FORCE_SCRIPT_NAME`` setting in your main ``settings`` file. This sets the
:setting:`FORCE_SCRIPT_NAME` setting in your main ``settings`` file. This sets the
script name uniformly for every URL served via that settings file. Thus you'll
need to use different settings files if you want different sets of URLs to
have different script names in this case, but that is a rare situation.

View File

@ -508,6 +508,115 @@ supports the FastCGI protocol. See the :doc:`FastCGI deployment documentation
.. _flup: http://www.saddi.com/software/flup/
The options accepted by this command are passed to the FastCGI library and
don't use the ``'--'`` prefix as is usual for other Django management commands.
.. django-admin-option:: protocol
``protocol=PROTOCOL``
Protocol to use. *PROTOCOL* can be ``fcgi``, ``scgi``, ``ajp``, etc.
(default is ``fcgi``)
.. django-admin-option:: host
``host=HOSTNAME``
Hostname to listen on.
.. django-admin-option:: port
``port=PORTNUM``
Port to listen on.
.. django-admin-option:: socket
``socket=FILE``
UNIX socket to listen on.
.. django-admin-option:: method
``method=IMPL``
Possible values: ``prefork`` or ``threaded`` (default ``prefork``)
.. django-admin-option:: maxrequests
``maxrequests=NUMBER``
Number of requests a child handles before it is killed and a new child is
forked (0 means no limit).
.. django-admin-option:: maxspare
``maxspare=NUMBER``
Max number of spare processes / threads.
.. django-admin-option:: minspare
``minspare=NUMBER``
Min number of spare processes / threads.
.. django-admin-option:: maxchildren
``maxchildren=NUMBER``
Hard limit number of processes / threads.
.. django-admin-option:: daemonize
``daemonize=BOOL``
Whether to detach from terminal.
.. django-admin-option:: pidfile
``pidfile=FILE``
Write the spawned process-id to file *FILE*.
.. django-admin-option:: workdir
``workdir=DIRECTORY``
Change to directory *DIRECTORY* when daemonizing.
.. django-admin-option:: debug
``debug=BOOL``
Set to true to enable flup tracebacks.
.. django-admin-option:: outlog
``outlog=FILE``
Write stdout to the *FILE* file.
.. django-admin-option:: errlog
``errlog=FILE``
Write stderr to the *FILE* file.
.. django-admin-option:: umask
``umask=UMASK``
Umask to use when daemonizing. The value is interpeted as an octal number
(default value is ``022``).
Example usage::
django-admin.py runfcgi socket=/tmp/fcgi.sock method=prefork daemonize=true \
pidfile=/var/run/django-fcgi.pid
Run a FastCGI server as a daemon and write the spawned PID in a file.
runserver [port or ipaddr:port]
-------------------------------