-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwsgi.py
More file actions
41 lines (32 loc) · 864 Bytes
/
wsgi.py
File metadata and controls
41 lines (32 loc) · 864 Bytes
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
# SYS
from sys import argv
import os.path
from os import getenv
import yaml
# MODULES
from server import WSGI
if "--dev" in argv:
with open(
os.path.join(os.path.dirname(__file__), "config", "dev.yml"), "r"
) as conn:
config = yaml.safe_load(conn)
else:
with open(
os.path.join(os.path.dirname(__file__), "config", "pro.yml"), "r"
) as conn:
config = yaml.safe_load(conn)
class App(object):
def __init__(self):
self.app = WSGI(config)
def __call__(self, *args, **kwargs):
return self.app(*args, **kwargs)
app = App()
if __name__ == "__main__":
from werkzeug.serving import run_simple
run_simple(
config["http"]["host"],
config["http"]["port"],
app,
use_debugger=config["server"]["debug"],
use_reloader=config["server"]["debug"],
)