From b80a3293542739b878f12c0b777ed3640aad5b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Avila?= Date: Sat, 22 Aug 2020 14:13:02 -0300 Subject: [PATCH] Correction on default value for config file (#2408) Running gunicorn project.app while having a file called gunicorn.conf.py in the current directory will read configuration from that file and actually fail if the file raises an exception. --- docs/source/settings.rst | 5 ++++- gunicorn/config.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/source/settings.rst b/docs/source/settings.rst index 3b01f68f..81b3c774 100644 --- a/docs/source/settings.rst +++ b/docs/source/settings.rst @@ -29,7 +29,7 @@ config ~~~~~~ * ``-c CONFIG, --config CONFIG`` -* ``None`` +* ``./gunicorn.conf.py`` The Gunicorn config file. @@ -38,6 +38,9 @@ A string of the form ``PATH``, ``file:PATH``, or ``python:MODULE_NAME``. Only has an effect when specified on the command line or as part of an application specific configuration. +By default, a file named ``gunicorn.conf.py`` will be read from the same +directory where gunicorn is being run. + .. versionchanged:: 19.4 Loading the config from a Python module requires the ``python:`` prefix. diff --git a/gunicorn/config.py b/gunicorn/config.py index da580322..b43e3922 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -546,7 +546,7 @@ class ConfigFile(Setting): cli = ["-c", "--config"] meta = "CONFIG" validator = validate_string - default = None + default = "./gunicorn.conf.py" desc = """\ The Gunicorn config file. @@ -555,6 +555,9 @@ class ConfigFile(Setting): Only has an effect when specified on the command line or as part of an application specific configuration. + By default, a file named ``gunicorn.conf.py`` will be read from the same + directory where gunicorn is being run. + .. versionchanged:: 19.4 Loading the config from a Python module requires the ``python:`` prefix.