Merge pull request #2253 from kmichel-sereema/2247-document-environment-variables

Document environment variables and $PORT
This commit is contained in:
Randall Leeds 2020-01-31 09:42:16 -08:00 committed by GitHub
commit 7d8c92f48a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 9 deletions

View File

@ -4,23 +4,36 @@
Configuration Overview
======================
Gunicorn pulls configuration information from three distinct places.
Gunicorn reads configuration information from five places.
The first place that Gunicorn will read configuration from is the framework
specific configuration file. Currently this only affects Paster applications.
Gunicorn first reads environment variables for some configuration
:ref:`settings <settings>`.
The second source of configuration information is a configuration file that is
optionally specified on the command line. Anything specified in the Gunicorn
config file will override any framework specific settings.
Gunicorn then reads configuration from a framework specific configuration
file. Currently this only affects Paster applications.
The third source of configuration information is an optional configuration file
``gunicorn.conf.py`` searched in the current working directory or specified
using a command line argument. Anything specified in this configuration file
will override any framework specific settings.
The fourth place of configuration information are command line arguments
stored in an environment variable named ``GUNICORN_CMD_ARGS``.
Lastly, the command line arguments used to invoke Gunicorn are the final place
considered for configuration settings. If an option is specified on the command
line, this is the value that will be used.
When a configuration file is specified in the command line arguments and in the
``GUNICORN_CMD_ARGS`` environment variable, only the configuration
file specified on the command line is used.
Once again, in order of least to most authoritative:
1. Framework Settings
2. Configuration File
3. Command Line
1. Environment Variables
2. Framework Settings
3. Configuration File
4. ``GUNICORN_CMD_ARGS``
5. Command Line
.. note::

View File

@ -1165,6 +1165,10 @@ Multiple addresses can be bound. ex.::
will bind the `test:app` application on localhost both on ipv6
and ipv4 interfaces.
If the ``PORT`` environment variable is defined, the default
is ``['0.0.0.0:$PORT']``. If it is not defined, the default
is ``['127.0.0.1:8000']``.
.. _backlog:
backlog

View File

@ -579,6 +579,10 @@ class Bind(Setting):
will bind the `test:app` application on localhost both on ipv6
and ipv4 interfaces.
If the ``PORT`` environment variable is defined, the default
is ``['0.0.0.0:$PORT']``. If it is not defined, the default
is ``['127.0.0.1:8000']``.
"""