-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgunicorn_config.py
70 lines (55 loc) · 1.5 KB
/
gunicorn_config.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import multiprocessing
import os
# Server socket
bind = os.getenv('GUNICORN_BIND', '0.0.0.0:8000')
backlog = 2048
# Worker processes
workers = os.getenv('GUNICORN_WORKERS', multiprocessing.cpu_count() * 2 + 1)
worker_class = 'sync'
worker_connections = 1000
timeout = 30
keepalive = 2
# Logging
accesslog = '-'
errorlog = '-'
loglevel = 'info'
# Process naming
proc_name = 'climate-monitor'
# Server mechanics
daemon = False
pidfile = 'gunicorn.pid'
umask = 0
user = None
group = None
tmp_upload_dir = None
# SSL
keyfile = None
certfile = None
# Server hooks
def on_starting(server):
"""Called just before the master process is initialized."""
pass
def on_reload(server):
"""Called to recycle workers during a reload via SIGHUP."""
pass
def when_ready(server):
"""Called just after the server is started."""
pass
def post_fork(server, worker):
"""Called just after a worker has been forked."""
server.log.info("Worker spawned (pid: %s)", worker.pid)
def pre_fork(server, worker):
"""Called just prior to forking the worker."""
pass
def pre_exec(server):
"""Called just prior to forking off a secondary master process during things like config reloading."""
pass
def worker_int(worker):
"""Called just after a worker exited on SIGINT or SIGQUIT."""
pass
def worker_abort(worker):
"""Called when a worker received the SIGABRT signal."""
pass
def worker_exit(server, worker):
"""Called just after a worker has been exited, in the worker process."""
pass