-
Notifications
You must be signed in to change notification settings - Fork 0
/
wsgi.py
32 lines (26 loc) · 812 Bytes
/
wsgi.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
import gunicorn.app.base
import gunicorn.glogging
import gunicorn.workers.sync
from app import app
class StandaloneApplication(gunicorn.app.base.BaseApplication):
def __init__(self, app, options=None):
self.options = options or {}
self.application = app
super().__init__()
def load_config(self):
config = {
key: value
for key, value in self.options.items()
if key in self.cfg.settings and value is not None
}
for key, value in config.items():
self.cfg.set(key.lower(), value)
def load(self):
return self.application
if __name__ == "__main__":
options = {
"bind": "0.0.0.0:9090",
"preload": True,
"workers": 3,
}
StandaloneApplication(app, options).run()