diff --git a/docs/source/settings.rst b/docs/source/settings.rst index 90bf9b74..eb191896 100644 --- a/docs/source/settings.rst +++ b/docs/source/settings.rst @@ -256,7 +256,7 @@ reload ~~~~~~ * ``--reload RELOADER_TYPE`` -* ``None`` +* ``off`` Restart workers when code changes. @@ -270,8 +270,8 @@ application code or the reload will not work as designed. When using this option, you can optionally specify whether you would like to use file system polling or the kernel's inotify API to watch for changes. Generally, inotify should be preferred if available -because it consumes less system resources. If no preference is given, -inotify will attempted with a fallback to FS polling. +because it consumes less system resources. The default behavior (auto) +is to attempt inotify with a fallback to FS polling. Note: In order to use the inotify reloader, you must have the 'inotify' package installed. diff --git a/gunicorn/config.py b/gunicorn/config.py index 60e93bf7..8369d974 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -492,15 +492,17 @@ def validate_hostport(val): def validate_reloader(val): if val is None: - val = 'default' + val = 'auto' - choices = ['poll', 'inotify', 'default'] + choices = ['auto', 'poll', 'inotify', 'off'] if val not in choices: raise ConfigError( 'Invalid reloader type. Must be one of: %s' % choices ) + return val + def get_default_config_file(): config_path = os.path.join(os.path.abspath(os.getcwd()), @@ -820,9 +822,7 @@ class Reload(Setting): section = 'Debugging' cli = ['--reload'] validator = validate_reloader - nargs = '?' - const = 'default' - default = None + default = 'off' meta = 'RELOADER_TYPE' desc = '''\ @@ -838,8 +838,8 @@ class Reload(Setting): When using this option, you can optionally specify whether you would like to use file system polling or the kernel's inotify API to watch for changes. Generally, inotify should be preferred if available - because it consumes less system resources. If no preference is given, - inotify will attempted with a fallback to FS polling. + because it consumes less system resources. The default behavior (auto) + is to attempt inotify with a fallback to FS polling. Note: In order to use the inotify reloader, you must have the 'inotify' package installed. diff --git a/gunicorn/workers/base.py b/gunicorn/workers/base.py index 885ff6d4..fd259461 100644 --- a/gunicorn/workers/base.py +++ b/gunicorn/workers/base.py @@ -115,7 +115,7 @@ class Worker(object): self.load_wsgi() # start the reloader - if self.cfg.reload: + if self.cfg.reload and self.cfg.reload != 'off': def changed(fname): self.log.info("Worker reloading: %s modified", fname) self.alive = False