From a8ce74b29be7e622dc0bc4a26ac04fa474e360a3 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 30 Jan 2014 12:14:18 -0500 Subject: [PATCH] Honor $WEB_CONCURRENCY environment variable. Allows for changing concurrency configuration without changing application code. This is an environment variable that other communities (e.g. Rails) are starting to follow, and have enjoyed for a little while now. Have discussed with /cc @benoitc in the past and he was +1 --- gunicorn/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gunicorn/config.py b/gunicorn/config.py index cf8144e3..2d8d73ac 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -98,7 +98,8 @@ class Config(object): @property def workers(self): - return self.settings['workers'].get() + env_workers = int(os.environ.get('WEB_CONCURRENCY')) + return self.settings['workers'].get() or env_workers @property def address(self):