mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Update gunicorn_ext.py
This commit is contained in:
parent
3273492811
commit
dad99a1bd4
@ -50,27 +50,29 @@ def format_settings(app):
|
|||||||
def fmt_setting(s):
|
def fmt_setting(s):
|
||||||
if callable(s.default):
|
if callable(s.default):
|
||||||
val = inspect.getsource(s.default)
|
val = inspect.getsource(s.default)
|
||||||
val = "\n".join(" %s" % l for l in val.splitlines())
|
val = "\n".join(" %s" % line for line in val.splitlines())
|
||||||
val = " ::\n\n" + val
|
val = "\n\n.. code-block:: python\n\n" + val
|
||||||
elif s.default == '':
|
elif s.default == '':
|
||||||
val = "``(empty string)``"
|
val = "``''``"
|
||||||
else:
|
else:
|
||||||
val = "``%s``" % s.default
|
val = "``%r``" % s.default
|
||||||
|
|
||||||
if s.cli and s.meta:
|
if s.cli and s.meta:
|
||||||
args = ["%s %s" % (arg, s.meta) for arg in s.cli]
|
cli = " or ".join("``%s %s``" % (arg, s.meta) for arg in s.cli)
|
||||||
cli = ', '.join(args)
|
|
||||||
elif s.cli:
|
elif s.cli:
|
||||||
cli = ", ".join(s.cli)
|
cli = " or ".join("``%s``" % arg for arg in s.cli)
|
||||||
|
else:
|
||||||
|
cli = ""
|
||||||
|
|
||||||
out = []
|
out = []
|
||||||
out.append(".. _%s:\n" % s.name.replace("_", "-"))
|
out.append(".. _%s:\n" % s.name.replace("_", "-"))
|
||||||
out.append("%s" % s.name)
|
out.append("``%s``" % s.name)
|
||||||
out.append("~" * len(s.name))
|
out.append("~" * (len(s.name) + 4))
|
||||||
out.append("")
|
out.append("")
|
||||||
if s.cli:
|
if s.cli:
|
||||||
out.append("* ``%s``" % cli)
|
out.append("**Command line:** %s" % cli)
|
||||||
out.append("* %s" % val)
|
out.append("")
|
||||||
|
out.append("**Default:** %s" % val)
|
||||||
out.append("")
|
out.append("")
|
||||||
out.append(s.desc)
|
out.append(s.desc)
|
||||||
out.append("")
|
out.append("")
|
||||||
|
|||||||
@ -29,6 +29,7 @@ Config File
|
|||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-c CONFIG`` or ``--config CONFIG``
|
**Command line:** ``-c CONFIG`` or ``--config CONFIG``
|
||||||
|
|
||||||
**Default:** ``'./gunicorn.conf.py'``
|
**Default:** ``'./gunicorn.conf.py'``
|
||||||
|
|
||||||
The Gunicorn config file.
|
The Gunicorn config file.
|
||||||
@ -65,6 +66,7 @@ Debugging
|
|||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--reload``
|
**Command line:** ``--reload``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Restart workers when code changes.
|
Restart workers when code changes.
|
||||||
@ -90,7 +92,8 @@ because it consumes less system resources.
|
|||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--reload-engine STRING``
|
**Command line:** ``--reload-engine STRING``
|
||||||
**Default:** ``auto``
|
|
||||||
|
**Default:** ``'auto'``
|
||||||
|
|
||||||
The implementation that should be used to power :ref:`reload`.
|
The implementation that should be used to power :ref:`reload`.
|
||||||
|
|
||||||
@ -108,6 +111,7 @@ Valid engines are:
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--reload-extra-file FILES``
|
**Command line:** ``--reload-extra-file FILES``
|
||||||
|
|
||||||
**Default:** ``[]``
|
**Default:** ``[]``
|
||||||
|
|
||||||
Extends :ref:`reload` option to also watch and reload on additional files
|
Extends :ref:`reload` option to also watch and reload on additional files
|
||||||
@ -121,6 +125,7 @@ Extends :ref:`reload` option to also watch and reload on additional files
|
|||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--spew``
|
**Command line:** ``--spew``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Install a trace function that spews every line executed by the server.
|
Install a trace function that spews every line executed by the server.
|
||||||
@ -133,10 +138,11 @@ This is the nuclear option.
|
|||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--check-config``
|
**Command line:** ``--check-config``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Check the configuration and exit. The exit status is 0 if the configuration is
|
Check the configuration and exit. The exit status is 0 if the
|
||||||
correct, and 1 if the configuration is incorrect.
|
configuration is correct, and 1 if the configuration is incorrect.
|
||||||
|
|
||||||
.. _print-config:
|
.. _print-config:
|
||||||
|
|
||||||
@ -144,6 +150,7 @@ correct, and 1 if the configuration is incorrect.
|
|||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--print-config``
|
**Command line:** ``--print-config``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Print the configuration settings as fully resolved. Implies :ref:`check-config`.
|
Print the configuration settings as fully resolved. Implies :ref:`check-config`.
|
||||||
@ -157,6 +164,7 @@ Logging
|
|||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--access-logfile FILE``
|
**Command line:** ``--access-logfile FILE``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
The Access log file to write to.
|
The Access log file to write to.
|
||||||
@ -169,6 +177,7 @@ The Access log file to write to.
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--disable-redirect-access-to-syslog``
|
**Command line:** ``--disable-redirect-access-to-syslog``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Disable redirect access logs to syslog.
|
Disable redirect access logs to syslog.
|
||||||
@ -181,6 +190,7 @@ Disable redirect access logs to syslog.
|
|||||||
~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--access-logformat STRING``
|
**Command line:** ``--access-logformat STRING``
|
||||||
|
|
||||||
**Default:** ``'%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'``
|
**Default:** ``'%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'``
|
||||||
|
|
||||||
The access log format.
|
The access log format.
|
||||||
@ -223,6 +233,7 @@ Use lowercase for header and environment variable names, and put
|
|||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--error-logfile FILE`` or ``--log-file FILE``
|
**Command line:** ``--error-logfile FILE`` or ``--log-file FILE``
|
||||||
|
|
||||||
**Default:** ``'-'``
|
**Default:** ``'-'``
|
||||||
|
|
||||||
The Error log file to write to.
|
The Error log file to write to.
|
||||||
@ -238,6 +249,7 @@ Using ``'-'`` for FILE makes gunicorn log to stderr.
|
|||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--log-level LEVEL``
|
**Command line:** ``--log-level LEVEL``
|
||||||
|
|
||||||
**Default:** ``'info'``
|
**Default:** ``'info'``
|
||||||
|
|
||||||
The granularity of Error log outputs.
|
The granularity of Error log outputs.
|
||||||
@ -256,6 +268,7 @@ Valid level names are:
|
|||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--capture-output``
|
**Command line:** ``--capture-output``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Redirect stdout/stderr to specified file in :ref:`errorlog`.
|
Redirect stdout/stderr to specified file in :ref:`errorlog`.
|
||||||
@ -264,10 +277,11 @@ Redirect stdout/stderr to specified file in :ref:`errorlog`.
|
|||||||
|
|
||||||
.. _logger-class:
|
.. _logger-class:
|
||||||
|
|
||||||
logger_class
|
``logger_class``
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--logger-class STRING``
|
**Command line:** ``--logger-class STRING``
|
||||||
|
|
||||||
**Default:** ``'gunicorn.glogging.Logger'``
|
**Default:** ``'gunicorn.glogging.Logger'``
|
||||||
|
|
||||||
The logger you want to use to log events in Gunicorn.
|
The logger you want to use to log events in Gunicorn.
|
||||||
@ -275,8 +289,8 @@ The logger you want to use to log events in Gunicorn.
|
|||||||
The default class (``gunicorn.glogging.Logger``) handles most
|
The default class (``gunicorn.glogging.Logger``) handles most
|
||||||
normal usages in logging. It provides error and access logging.
|
normal usages in logging. It provides error and access logging.
|
||||||
|
|
||||||
You can provide your own logger by giving Gunicorn a
|
You can provide your own logger by giving Gunicorn a Python path to a
|
||||||
Python path to a subclass of ``gunicorn.glogging.Logger``.
|
class that quacks like ``gunicorn.glogging.Logger``.
|
||||||
|
|
||||||
.. _logconfig:
|
.. _logconfig:
|
||||||
|
|
||||||
@ -284,6 +298,7 @@ Python path to a subclass of ``gunicorn.glogging.Logger``.
|
|||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--log-config FILE``
|
**Command line:** ``--log-config FILE``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
The log config file to use.
|
The log config file to use.
|
||||||
@ -296,6 +311,7 @@ file format.
|
|||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--log-config-dict``
|
**Command line:** ``--log-config-dict``
|
||||||
|
|
||||||
**Default:** ``{}``
|
**Default:** ``{}``
|
||||||
|
|
||||||
The log config dictionary to use, using the standard Python
|
The log config dictionary to use, using the standard Python
|
||||||
@ -313,6 +329,7 @@ Format: https://docs.python.org/3/library/logging.config.html#logging.config.dic
|
|||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--log-syslog-to SYSLOG_ADDR``
|
**Command line:** ``--log-syslog-to SYSLOG_ADDR``
|
||||||
|
|
||||||
**Default:** ``'unix:///var/run/syslog'``
|
**Default:** ``'unix:///var/run/syslog'``
|
||||||
|
|
||||||
Address to send syslog messages.
|
Address to send syslog messages.
|
||||||
@ -331,6 +348,7 @@ Address is a string of the form:
|
|||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--log-syslog``
|
**Command line:** ``--log-syslog``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Send *Gunicorn* logs to syslog.
|
Send *Gunicorn* logs to syslog.
|
||||||
@ -345,6 +363,7 @@ Send *Gunicorn* logs to syslog.
|
|||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--log-syslog-prefix SYSLOG_PREFIX``
|
**Command line:** ``--log-syslog-prefix SYSLOG_PREFIX``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
Makes Gunicorn use the parameter as program-name in the syslog entries.
|
Makes Gunicorn use the parameter as program-name in the syslog entries.
|
||||||
@ -358,6 +377,7 @@ program name is the name of the process.
|
|||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--log-syslog-facility SYSLOG_FACILITY``
|
**Command line:** ``--log-syslog-facility SYSLOG_FACILITY``
|
||||||
|
|
||||||
**Default:** ``'user'``
|
**Default:** ``'user'``
|
||||||
|
|
||||||
Syslog facility name
|
Syslog facility name
|
||||||
@ -367,7 +387,8 @@ Syslog facility name
|
|||||||
``enable_stdio_inheritance``
|
``enable_stdio_inheritance``
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-R, --enable-stdio-inheritance``
|
**Command line:** ``-R`` or ``--enable-stdio-inheritance``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Enable stdio inheritance.
|
Enable stdio inheritance.
|
||||||
@ -383,6 +404,7 @@ environment variable ``PYTHONUNBUFFERED`` .
|
|||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--statsd-host STATSD_ADDR``
|
**Command line:** ``--statsd-host STATSD_ADDR``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
``host:port`` of the statsd server to log to.
|
``host:port`` of the statsd server to log to.
|
||||||
@ -395,10 +417,11 @@ environment variable ``PYTHONUNBUFFERED`` .
|
|||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--dogstatsd-tags DOGSTATSD_TAGS``
|
**Command line:** ``--dogstatsd-tags DOGSTATSD_TAGS``
|
||||||
|
|
||||||
**Default:** ``''``
|
**Default:** ``''``
|
||||||
|
|
||||||
A comma-delimited list of datadog statsd (dogstatsd) tags to append to statsd
|
A comma-delimited list of datadog statsd (dogstatsd) tags to append to
|
||||||
metrics.
|
statsd metrics.
|
||||||
|
|
||||||
.. versionadded:: 20
|
.. versionadded:: 20
|
||||||
|
|
||||||
@ -408,6 +431,7 @@ metrics.
|
|||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--statsd-prefix STATSD_PREFIX``
|
**Command line:** ``--statsd-prefix STATSD_PREFIX``
|
||||||
|
|
||||||
**Default:** ``''``
|
**Default:** ``''``
|
||||||
|
|
||||||
Prefix to use when emitting statsd metrics (a trailing ``.`` is added,
|
Prefix to use when emitting statsd metrics (a trailing ``.`` is added,
|
||||||
@ -423,7 +447,8 @@ Process Naming
|
|||||||
``proc_name``
|
``proc_name``
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-n STRING, --name STRING``
|
**Command line:** ``-n STRING`` or ``--name STRING``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
A base to use with setproctitle for process naming.
|
A base to use with setproctitle for process naming.
|
||||||
@ -453,9 +478,10 @@ SSL
|
|||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--keyfile FILE``
|
**Command line:** ``--keyfile FILE``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
Path to the SSL key file.
|
SSL key file
|
||||||
|
|
||||||
.. _certfile:
|
.. _certfile:
|
||||||
|
|
||||||
@ -463,9 +489,10 @@ Path to the SSL key file.
|
|||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--certfile FILE``
|
**Command line:** ``--certfile FILE``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
Path to the SSL certificate file.
|
SSL certificate file
|
||||||
|
|
||||||
.. _ssl-version:
|
.. _ssl-version:
|
||||||
|
|
||||||
@ -473,7 +500,8 @@ Path to the SSL certificate file.
|
|||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--ssl-version``
|
**Command line:** ``--ssl-version``
|
||||||
**Default:** ``_SSLMethod.PROTOCOL_TLS``
|
|
||||||
|
**Default:** ``<_SSLMethod.PROTOCOL_TLS: 2>``
|
||||||
|
|
||||||
SSL version to use.
|
SSL version to use.
|
||||||
|
|
||||||
@ -505,19 +533,21 @@ TLS_SERVER Auto-negotiate the highest protocol version like TLS,
|
|||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--cert-reqs``
|
**Command line:** ``--cert-reqs``
|
||||||
**Default:** ``VerifyMode.CERT_NONE``
|
|
||||||
|
|
||||||
Whether client certificate is required (see stdlib ssl module's).
|
**Default:** ``<VerifyMode.CERT_NONE: 0>``
|
||||||
|
|
||||||
|
Whether client certificate is required (see stdlib ssl module's)
|
||||||
|
|
||||||
.. _ca-certs:
|
.. _ca-certs:
|
||||||
|
|
||||||
``ca_certs``
|
``ca_certs``
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
* ``--ca-certs FILE``
|
**Command line:** ``--ca-certs FILE``
|
||||||
* ``None``
|
|
||||||
|
|
||||||
Path to the CA certificates file.
|
**Default:** ``None``
|
||||||
|
|
||||||
|
CA certificates file
|
||||||
|
|
||||||
.. _suppress-ragged-eofs:
|
.. _suppress-ragged-eofs:
|
||||||
|
|
||||||
@ -525,6 +555,7 @@ Path to the CA certificates file.
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--suppress-ragged-eofs``
|
**Command line:** ``--suppress-ragged-eofs``
|
||||||
|
|
||||||
**Default:** ``True``
|
**Default:** ``True``
|
||||||
|
|
||||||
Suppress ragged EOFs (see stdlib ssl module's)
|
Suppress ragged EOFs (see stdlib ssl module's)
|
||||||
@ -535,6 +566,7 @@ Suppress ragged EOFs (see stdlib ssl module's)
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--do-handshake-on-connect``
|
**Command line:** ``--do-handshake-on-connect``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Whether to perform SSL handshake on socket connect (see stdlib ssl module's)
|
Whether to perform SSL handshake on socket connect (see stdlib ssl module's)
|
||||||
@ -545,6 +577,7 @@ Whether to perform SSL handshake on socket connect (see stdlib ssl module's)
|
|||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--ciphers``
|
**Command line:** ``--ciphers``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
SSL Cipher suite to use, in the format of an OpenSSL cipher list.
|
SSL Cipher suite to use, in the format of an OpenSSL cipher list.
|
||||||
@ -571,6 +604,7 @@ Security
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--limit-request-line INT``
|
**Command line:** ``--limit-request-line INT``
|
||||||
|
|
||||||
**Default:** ``4094``
|
**Default:** ``4094``
|
||||||
|
|
||||||
The maximum size of HTTP request line in bytes.
|
The maximum size of HTTP request line in bytes.
|
||||||
@ -592,6 +626,7 @@ This parameter can be used to prevent any DDOS attack.
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--limit-request-fields INT``
|
**Command line:** ``--limit-request-fields INT``
|
||||||
|
|
||||||
**Default:** ``100``
|
**Default:** ``100``
|
||||||
|
|
||||||
Limit the number of HTTP headers fields in a request.
|
Limit the number of HTTP headers fields in a request.
|
||||||
@ -607,6 +642,7 @@ more safety. By default this value is 100 and can't be larger than
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--limit-request-field_size INT``
|
**Command line:** ``--limit-request-field_size INT``
|
||||||
|
|
||||||
**Default:** ``8190``
|
**Default:** ``8190``
|
||||||
|
|
||||||
Limit the allowed size of an HTTP request header field.
|
Limit the allowed size of an HTTP request header field.
|
||||||
@ -621,20 +657,17 @@ header field sizes.
|
|||||||
Server Hooks
|
Server Hooks
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Define these functions with these names in your configuration file and Gunicorn
|
|
||||||
will call them at the appropriate times during the server lifecycle.
|
|
||||||
|
|
||||||
.. _on-starting:
|
.. _on-starting:
|
||||||
|
|
||||||
``on_starting``
|
``on_starting``
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def on_starting(server):
|
def on_starting(server):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just before the master process is initialized.
|
Called just before the master process is initialized.
|
||||||
|
|
||||||
@ -645,12 +678,12 @@ The callable needs to accept a single instance variable for the Arbiter.
|
|||||||
``on_reload``
|
``on_reload``
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def on_reload(server):
|
def on_reload(server):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called to recycle workers during a reload via SIGHUP.
|
Called to recycle workers during a reload via SIGHUP.
|
||||||
|
|
||||||
@ -661,12 +694,12 @@ The callable needs to accept a single instance variable for the Arbiter.
|
|||||||
``when_ready``
|
``when_ready``
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def when_ready(server):
|
def when_ready(server):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just after the server is started.
|
Called just after the server is started.
|
||||||
|
|
||||||
@ -677,12 +710,12 @@ The callable needs to accept a single instance variable for the Arbiter.
|
|||||||
``pre_fork``
|
``pre_fork``
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def pre_fork(server, worker):
|
def pre_fork(server, worker):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just before a worker is forked.
|
Called just before a worker is forked.
|
||||||
|
|
||||||
@ -694,12 +727,12 @@ new Worker.
|
|||||||
``post_fork``
|
``post_fork``
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def post_fork(server, worker):
|
def post_fork(server, worker):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just after a worker has been forked.
|
Called just after a worker has been forked.
|
||||||
|
|
||||||
@ -711,12 +744,12 @@ new Worker.
|
|||||||
``post_worker_init``
|
``post_worker_init``
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def post_worker_init(worker):
|
def post_worker_init(worker):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just after a worker has initialized the application.
|
Called just after a worker has initialized the application.
|
||||||
|
|
||||||
@ -728,12 +761,12 @@ Worker.
|
|||||||
``worker_int``
|
``worker_int``
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def worker_int(worker):
|
def worker_int(worker):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just after a worker exited on SIGINT or SIGQUIT.
|
Called just after a worker exited on SIGINT or SIGQUIT.
|
||||||
|
|
||||||
@ -745,12 +778,12 @@ Worker.
|
|||||||
``worker_abort``
|
``worker_abort``
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def worker_abort(worker):
|
def worker_abort(worker):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called when a worker received the SIGABRT signal.
|
Called when a worker received the SIGABRT signal.
|
||||||
|
|
||||||
@ -764,12 +797,12 @@ Worker.
|
|||||||
``pre_exec``
|
``pre_exec``
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def pre_exec(server):
|
def pre_exec(server):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just before a new master process is forked.
|
Called just before a new master process is forked.
|
||||||
|
|
||||||
@ -780,12 +813,12 @@ The callable needs to accept a single instance variable for the Arbiter.
|
|||||||
``pre_request``
|
``pre_request``
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def pre_request(worker, req):
|
def pre_request(worker, req):
|
||||||
worker.log.debug("%s %s" % (req.method, req.path))
|
worker.log.debug("%s %s" % (req.method, req.path))
|
||||||
|
|
||||||
Called just before a worker processes the request.
|
Called just before a worker processes the request.
|
||||||
|
|
||||||
@ -797,12 +830,12 @@ the Request.
|
|||||||
``post_request``
|
``post_request``
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def post_request(worker, req, environ, resp):
|
def post_request(worker, req, environ, resp):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called after a worker processes the request.
|
Called after a worker processes the request.
|
||||||
|
|
||||||
@ -814,12 +847,12 @@ the Request.
|
|||||||
``child_exit``
|
``child_exit``
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def child_exit(server, worker):
|
def child_exit(server, worker):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just after a worker has been exited, in the master process.
|
Called just after a worker has been exited, in the master process.
|
||||||
|
|
||||||
@ -833,12 +866,12 @@ the just-exited Worker.
|
|||||||
``worker_exit``
|
``worker_exit``
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def worker_exit(server, worker):
|
def worker_exit(server, worker):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just after a worker has been exited, in the worker process.
|
Called just after a worker has been exited, in the worker process.
|
||||||
|
|
||||||
@ -850,12 +883,12 @@ the just-exited Worker.
|
|||||||
``nworkers_changed``
|
``nworkers_changed``
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def nworkers_changed(server, new_value, old_value):
|
def nworkers_changed(server, new_value, old_value):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just after *num_workers* has been changed.
|
Called just after *num_workers* has been changed.
|
||||||
|
|
||||||
@ -870,12 +903,12 @@ be ``None``.
|
|||||||
``on_exit``
|
``on_exit``
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
Signature:
|
**Default:**
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def on_exit(server):
|
def on_exit(server):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Called just before exiting Gunicorn.
|
Called just before exiting Gunicorn.
|
||||||
|
|
||||||
@ -890,6 +923,7 @@ Server Mechanics
|
|||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--preload``
|
**Command line:** ``--preload``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Load application code before the worker processes are forked.
|
Load application code before the worker processes are forked.
|
||||||
@ -905,6 +939,7 @@ restarting workers.
|
|||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--no-sendfile``
|
**Command line:** ``--no-sendfile``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
Disables the use of ``sendfile()``.
|
Disables the use of ``sendfile()``.
|
||||||
@ -925,6 +960,7 @@ to enable or disable its usage.
|
|||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--reuse-port``
|
**Command line:** ``--reuse-port``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Set the ``SO_REUSEPORT`` flag on the listening socket.
|
Set the ``SO_REUSEPORT`` flag on the listening socket.
|
||||||
@ -937,9 +973,10 @@ Set the ``SO_REUSEPORT`` flag on the listening socket.
|
|||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--chdir``
|
**Command line:** ``--chdir``
|
||||||
**Default:** ``'/usr/src/app'``
|
|
||||||
|
|
||||||
Change to the specified directory before loading apps.
|
**Default:** ``'/Users/chainz/Documents/Projects/gunicorn/docs'``
|
||||||
|
|
||||||
|
Change directory to specified directory before loading apps.
|
||||||
|
|
||||||
.. _daemon:
|
.. _daemon:
|
||||||
|
|
||||||
@ -947,6 +984,7 @@ Change to the specified directory before loading apps.
|
|||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-D`` or ``--daemon``
|
**Command line:** ``-D`` or ``--daemon``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Daemonize the Gunicorn process.
|
Daemonize the Gunicorn process.
|
||||||
@ -960,13 +998,14 @@ background.
|
|||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-e ENV`` or ``--env ENV``
|
**Command line:** ``-e ENV`` or ``--env ENV``
|
||||||
|
|
||||||
**Default:** ``[]``
|
**Default:** ``[]``
|
||||||
|
|
||||||
Set environment variables in the execution environment.
|
Set environment variables in the execution environment.
|
||||||
|
|
||||||
Should be a list of strings in the ``key=value`` format.
|
Should be a list of strings in the ``key=value`` format.
|
||||||
|
|
||||||
For example:
|
For example on the command line:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
@ -984,6 +1023,7 @@ Or in the configuration file:
|
|||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-p FILE`` or ``--pid FILE``
|
**Command line:** ``-p FILE`` or ``--pid FILE``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
A filename to use for the PID file.
|
A filename to use for the PID file.
|
||||||
@ -996,6 +1036,7 @@ If not set, no PID file will be written.
|
|||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--worker-tmp-dir DIR``
|
**Command line:** ``--worker-tmp-dir DIR``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
A directory to use for the worker heartbeat temporary file.
|
A directory to use for the worker heartbeat temporary file.
|
||||||
@ -1016,6 +1057,7 @@ If not set, the default temporary directory will be used.
|
|||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-u USER`` or ``--user USER``
|
**Command line:** ``-u USER`` or ``--user USER``
|
||||||
|
|
||||||
**Default:** ``501``
|
**Default:** ``501``
|
||||||
|
|
||||||
Switch worker processes to run as this user.
|
Switch worker processes to run as this user.
|
||||||
@ -1030,6 +1072,7 @@ change the worker process user.
|
|||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-g GROUP`` or ``--group GROUP``
|
**Command line:** ``-g GROUP`` or ``--group GROUP``
|
||||||
|
|
||||||
**Default:** ``20``
|
**Default:** ``20``
|
||||||
|
|
||||||
Switch worker process to run as this group.
|
Switch worker process to run as this group.
|
||||||
@ -1044,6 +1087,7 @@ change the worker processes group.
|
|||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-m INT`` or ``--umask INT``
|
**Command line:** ``-m INT`` or ``--umask INT``
|
||||||
|
|
||||||
**Default:** ``0``
|
**Default:** ``0``
|
||||||
|
|
||||||
A bit mask for the file mode on files written by Gunicorn.
|
A bit mask for the file mode on files written by Gunicorn.
|
||||||
@ -1061,6 +1105,7 @@ representations)
|
|||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--initgroups``
|
**Command line:** ``--initgroups``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
If true, set the worker process's group access list with all of the
|
If true, set the worker process's group access list with all of the
|
||||||
@ -1110,6 +1155,7 @@ the headers defined here can not be passed directly from the client.
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--forwarded-allow-ips STRING``
|
**Command line:** ``--forwarded-allow-ips STRING``
|
||||||
|
|
||||||
**Default:** ``'127.0.0.1'``
|
**Default:** ``'127.0.0.1'``
|
||||||
|
|
||||||
Front-end's IPs from which allowed to handle set secure headers.
|
Front-end's IPs from which allowed to handle set secure headers.
|
||||||
@ -1128,6 +1174,7 @@ variable. If it is not defined, the default is ``"127.0.0.1"``.
|
|||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--pythonpath STRING``
|
**Command line:** ``--pythonpath STRING``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
A comma-separated list of directories to add to the Python path.
|
A comma-separated list of directories to add to the Python path.
|
||||||
@ -1141,6 +1188,7 @@ e.g.
|
|||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--paste STRING`` or ``--paster STRING``
|
**Command line:** ``--paste STRING`` or ``--paster STRING``
|
||||||
|
|
||||||
**Default:** ``None``
|
**Default:** ``None``
|
||||||
|
|
||||||
Load a PasteDeploy config file. The argument may contain a ``#``
|
Load a PasteDeploy config file. The argument may contain a ``#``
|
||||||
@ -1156,6 +1204,7 @@ command line arguments to control server configuration instead.
|
|||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--proxy-protocol``
|
**Command line:** ``--proxy-protocol``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Enable detect PROXY protocol (PROXY mode).
|
Enable detect PROXY protocol (PROXY mode).
|
||||||
@ -1180,6 +1229,7 @@ Example for stunnel config::
|
|||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--proxy-allow-from``
|
**Command line:** ``--proxy-allow-from``
|
||||||
|
|
||||||
**Default:** ``'127.0.0.1'``
|
**Default:** ``'127.0.0.1'``
|
||||||
|
|
||||||
Front-end's IPs from which allowed accept proxy requests (comma separate).
|
Front-end's IPs from which allowed accept proxy requests (comma separate).
|
||||||
@ -1194,6 +1244,7 @@ you still trust the environment)
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--paste-global CONF``
|
**Command line:** ``--paste-global CONF``
|
||||||
|
|
||||||
**Default:** ``[]``
|
**Default:** ``[]``
|
||||||
|
|
||||||
Set a PasteDeploy global config variable in ``key=value`` form.
|
Set a PasteDeploy global config variable in ``key=value`` form.
|
||||||
@ -1212,6 +1263,7 @@ The variables are passed to the the PasteDeploy entrypoint. Example::
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--strip-header-spaces``
|
**Command line:** ``--strip-header-spaces``
|
||||||
|
|
||||||
**Default:** ``False``
|
**Default:** ``False``
|
||||||
|
|
||||||
Strip spaces present between the header name and the the ``:``.
|
Strip spaces present between the header name and the the ``:``.
|
||||||
@ -1229,7 +1281,8 @@ Server Socket
|
|||||||
``bind``
|
``bind``
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-b ADDRESS, --bind ADDRESS``
|
**Command line:** ``-b ADDRESS`` or ``--bind ADDRESS``
|
||||||
|
|
||||||
**Default:** ``['127.0.0.1:8000']``
|
**Default:** ``['127.0.0.1:8000']``
|
||||||
|
|
||||||
The socket to bind.
|
The socket to bind.
|
||||||
@ -1257,6 +1310,7 @@ is ``['127.0.0.1:8000']``.
|
|||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--backlog INT``
|
**Command line:** ``--backlog INT``
|
||||||
|
|
||||||
**Default:** ``2048``
|
**Default:** ``2048``
|
||||||
|
|
||||||
The maximum number of pending connections.
|
The maximum number of pending connections.
|
||||||
@ -1276,7 +1330,8 @@ Worker Processes
|
|||||||
``workers``
|
``workers``
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-w INT, --workers INT``
|
**Command line:** ``-w INT`` or ``--workers INT``
|
||||||
|
|
||||||
**Default:** ``1``
|
**Default:** ``1``
|
||||||
|
|
||||||
The number of worker processes for handling requests.
|
The number of worker processes for handling requests.
|
||||||
@ -1294,6 +1349,7 @@ If it is not defined, the default is ``1``.
|
|||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-k STRING`` or ``--worker-class STRING``
|
**Command line:** ``-k STRING`` or ``--worker-class STRING``
|
||||||
|
|
||||||
**Default:** ``'sync'``
|
**Default:** ``'sync'``
|
||||||
|
|
||||||
The type of workers to use.
|
The type of workers to use.
|
||||||
@ -1326,6 +1382,7 @@ This alternative syntax will load the gevent class:
|
|||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--threads INT``
|
**Command line:** ``--threads INT``
|
||||||
|
|
||||||
**Default:** ``1``
|
**Default:** ``1``
|
||||||
|
|
||||||
The number of worker threads for handling requests.
|
The number of worker threads for handling requests.
|
||||||
@ -1351,6 +1408,7 @@ This setting only affects the Gthread worker type.
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--worker-connections INT``
|
**Command line:** ``--worker-connections INT``
|
||||||
|
|
||||||
**Default:** ``1000``
|
**Default:** ``1000``
|
||||||
|
|
||||||
The maximum number of simultaneous clients.
|
The maximum number of simultaneous clients.
|
||||||
@ -1363,6 +1421,7 @@ This setting only affects the Eventlet and Gevent worker types.
|
|||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--max-requests INT``
|
**Command line:** ``--max-requests INT``
|
||||||
|
|
||||||
**Default:** ``0``
|
**Default:** ``0``
|
||||||
|
|
||||||
The maximum number of requests a worker will process before restarting.
|
The maximum number of requests a worker will process before restarting.
|
||||||
@ -1380,6 +1439,7 @@ restarts are disabled.
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--max-requests-jitter INT``
|
**Command line:** ``--max-requests-jitter INT``
|
||||||
|
|
||||||
**Default:** ``0``
|
**Default:** ``0``
|
||||||
|
|
||||||
The maximum jitter to add to the *max_requests* setting.
|
The maximum jitter to add to the *max_requests* setting.
|
||||||
@ -1396,6 +1456,7 @@ restarts to avoid all workers restarting at the same time.
|
|||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``-t INT`` or ``--timeout INT``
|
**Command line:** ``-t INT`` or ``--timeout INT``
|
||||||
|
|
||||||
**Default:** ``30``
|
**Default:** ``30``
|
||||||
|
|
||||||
Workers silent for more than this many seconds are killed and restarted.
|
Workers silent for more than this many seconds are killed and restarted.
|
||||||
@ -1415,6 +1476,7 @@ single request.
|
|||||||
~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--graceful-timeout INT``
|
**Command line:** ``--graceful-timeout INT``
|
||||||
|
|
||||||
**Default:** ``30``
|
**Default:** ``30``
|
||||||
|
|
||||||
Timeout for graceful workers restart.
|
Timeout for graceful workers restart.
|
||||||
@ -1429,6 +1491,7 @@ the receipt of the restart signal) are force killed.
|
|||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
**Command line:** ``--keep-alive INT``
|
**Command line:** ``--keep-alive INT``
|
||||||
|
|
||||||
**Default:** ``2``
|
**Default:** ``2``
|
||||||
|
|
||||||
The number of seconds to wait for requests on a Keep-Alive connection.
|
The number of seconds to wait for requests on a Keep-Alive connection.
|
||||||
|
|||||||
@ -929,9 +929,9 @@ class ReloadEngine(Setting):
|
|||||||
|
|
||||||
Valid engines are:
|
Valid engines are:
|
||||||
|
|
||||||
* 'auto'
|
* ``'auto'``
|
||||||
* 'poll'
|
* ``'poll'``
|
||||||
* 'inotify' (requires inotify)
|
* ``'inotify'`` (requires inotify)
|
||||||
|
|
||||||
.. versionadded:: 19.7
|
.. versionadded:: 19.7
|
||||||
"""
|
"""
|
||||||
@ -975,7 +975,8 @@ class ConfigCheck(Setting):
|
|||||||
action = "store_true"
|
action = "store_true"
|
||||||
default = False
|
default = False
|
||||||
desc = """\
|
desc = """\
|
||||||
Check the configuration.
|
Check the configuration and exit. The exit status is 0 if the
|
||||||
|
configuration is correct, and 1 if the configuration is incorrect.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -1053,7 +1054,7 @@ class Chdir(Setting):
|
|||||||
validator = validate_chdir
|
validator = validate_chdir
|
||||||
default = util.getcwd()
|
default = util.getcwd()
|
||||||
desc = """\
|
desc = """\
|
||||||
Chdir to specified directory before apps loading.
|
Change directory to specified directory before loading apps.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -1082,13 +1083,21 @@ class Env(Setting):
|
|||||||
default = []
|
default = []
|
||||||
|
|
||||||
desc = """\
|
desc = """\
|
||||||
Set environment variable (key=value).
|
Set environment variables in the execution environment.
|
||||||
|
|
||||||
Pass variables to the execution environment. Ex.::
|
Should be a list of strings in the ``key=value`` format.
|
||||||
|
|
||||||
|
For example on the command line:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
$ gunicorn -b 127.0.0.1:8000 --env FOO=1 test:app
|
$ gunicorn -b 127.0.0.1:8000 --env FOO=1 test:app
|
||||||
|
|
||||||
and test for the foo variable environment in your application.
|
Or in the configuration file:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
raw_env = ["FOO=1"]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -1362,11 +1371,11 @@ class Loglevel(Setting):
|
|||||||
|
|
||||||
Valid level names are:
|
Valid level names are:
|
||||||
|
|
||||||
* debug
|
* ``'debug'``
|
||||||
* info
|
* ``'info'``
|
||||||
* warning
|
* ``'warning'``
|
||||||
* error
|
* ``'error'``
|
||||||
* critical
|
* ``'critical'``
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -1394,11 +1403,11 @@ class LoggerClass(Setting):
|
|||||||
desc = """\
|
desc = """\
|
||||||
The logger you want to use to log events in Gunicorn.
|
The logger you want to use to log events in Gunicorn.
|
||||||
|
|
||||||
The default class (``gunicorn.glogging.Logger``) handle most of
|
The default class (``gunicorn.glogging.Logger``) handles most
|
||||||
normal usages in logging. It provides error and access logging.
|
normal usages in logging. It provides error and access logging.
|
||||||
|
|
||||||
You can provide your own logger by giving Gunicorn a
|
You can provide your own logger by giving Gunicorn a Python path to a
|
||||||
Python path to a subclass like ``gunicorn.glogging.Logger``.
|
class that quacks like ``gunicorn.glogging.Logger``.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -1546,7 +1555,8 @@ class DogstatsdTags(Setting):
|
|||||||
default = ""
|
default = ""
|
||||||
validator = validate_string
|
validator = validate_string
|
||||||
desc = """\
|
desc = """\
|
||||||
A comma-delimited list of datadog statsd (dogstatsd) tags to append to statsd metrics.
|
A comma-delimited list of datadog statsd (dogstatsd) tags to append to
|
||||||
|
statsd metrics.
|
||||||
|
|
||||||
.. versionadded:: 20
|
.. versionadded:: 20
|
||||||
"""
|
"""
|
||||||
@ -2101,9 +2111,9 @@ class StripHeaderSpaces(Setting):
|
|||||||
default = False
|
default = False
|
||||||
desc = """\
|
desc = """\
|
||||||
Strip spaces present between the header name and the the ``:``.
|
Strip spaces present between the header name and the the ``:``.
|
||||||
|
|
||||||
This is known to induce vulnerabilities and is not compliant with the HTTP/1.1 standard.
|
This is known to induce vulnerabilities and is not compliant with the HTTP/1.1 standard.
|
||||||
See https://portswigger.net/research/http-desync-attacks-request-smuggling-reborn.
|
See https://portswigger.net/research/http-desync-attacks-request-smuggling-reborn.
|
||||||
|
|
||||||
Use with care and only if necessary.
|
Use with care and only if necessary.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user