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
This commit is contained in:
Kenneth Reitz 2014-01-30 12:14:18 -05:00
parent d4f2481384
commit a8ce74b29b

View File

@ -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):