-
Notifications
You must be signed in to change notification settings - Fork 0
/
appRun.py
49 lines (40 loc) · 949 Bytes
/
appRun.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
# std:
import os;
import sys;
# pip-ext:
import waitress;
import dotenv;
# pip-int:
# n/a
# loc:
# DELAYED
print(""); # newline
assert len(sys.argv) == 2;
envFilename = sys.argv[1];
for (key, value) in dotenv.dotenv_values(envFilename).items():
if key not in os.environ:
os.environ[key] = value;
# loc:
from constants import K;
from appHub import app;
import bu;
def run ():
if K.DEBUG is True:
bu.bottle.debug(True);
print("Enabled DEBUG mode.");
print("Serving @ %s:%s ...\n" % (K.RUN_HOST, K.RUN_PORT));
waitress.serve(app=app, host=K.RUN_HOST, port=K.RUN_PORT);
# Run: #####################################################
if __name__ == "__main__":
run();
# Note
# ----
# Ways to run:
#
# 1. Without hot reload:
# python appRun.py env-*.txt
#
# 2. With hot reload, for dev:
# hupper -m appRun env-*.txt
#
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx