forked from hypothesis/h
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgunicorn.conf.py
31 lines (23 loc) · 1.01 KB
/
gunicorn.conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
if 'GUNICORN_TIMEOUT' in os.environ:
timeout = int(os.environ['GUNICORN_TIMEOUT'])
# Smart detect heroku stack and assume a trusted proxy.
# This is a convenience that should hopefully not be too surprising.
if 'heroku' in os.environ.get('LD_LIBRARY_PATH', ''):
forwarded_allow_ips = '*'
if 'H_GUNICORN_CERTFILE' in os.environ:
certfile = os.environ['H_GUNICORN_CERTFILE']
if 'H_GUNICORN_KEYFILE' in os.environ:
keyfile = os.environ['H_GUNICORN_KEYFILE']
def post_fork(server, worker):
# Support back-ported SSL changes on Debian / Ubuntu
import _ssl
import gevent.hub
if hasattr(_ssl, 'SSLContext') and not hasattr(_ssl, '_sslwrap'):
gevent.hub.PYGTE279 = True
def when_ready(server):
name = server.proc_name
if name == 'web' and 'WEB_NUM_WORKERS' in os.environ:
server.num_workers = int(os.environ['WEB_NUM_WORKERS'])
elif name == 'websocket' and 'WEBSOCKET_NUM_WORKERS' in os.environ:
server.num_workers = int(os.environ['WEBSOCKET_NUM_WORKERS'])