forked from udf/uniborg
-
Notifications
You must be signed in to change notification settings - Fork 2
/
start_server.py
39 lines (33 loc) · 940 Bytes
/
start_server.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
import sys
import uvicorn
from uvicorn.config import LOGGING_CONFIG
try:
from IPython import embed
except:
pass
def main():
root_path = ""
# if len(sys.argv) >= 2:
# root_path = sys.argv[1]
##
# %(name)s : uvicorn, uvicorn.error, ... . Not insightful at all.
LOGGING_CONFIG["formatters"]["access"][
"fmt"
] = '%(asctime)s %(levelprefix)s %(client_addr)s - "%(request_line)s" %(status_code)s'
LOGGING_CONFIG["formatters"]["default"][
"fmt"
] = "%(asctime)s %(levelprefix)s %(message)s"
date_fmt = "%Y-%m-%d %H:%M:%S"
LOGGING_CONFIG["formatters"]["default"]["datefmt"] = date_fmt
LOGGING_CONFIG["formatters"]["access"]["datefmt"] = date_fmt
##
uvicorn.run(
"stdborg:app",
host="127.0.0.1",
port=5922,
log_level="info",
proxy_headers=True,
root_path=root_path,
)
if __name__ == "__main__":
main()