-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
executable file
·41 lines (31 loc) · 1.02 KB
/
main.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
"""
Description:
- AiReport project. This is a demo POC project, it is not intented
for production. The quality of the code is not guaranteed.
If you refrence the code in this project, it means that you understand
the risk and you are responsible for any issues caused by the code.
History:
- 2025/01/20 by Hysun ([email protected]): Initial implementation.
"""
import sys
import os
import uvicorn
path = os.path.abspath(os.path.join(os.path.dirname(__file__), "."))
print(f"Path: {path}")
if not path in sys.path:
sys.path.insert(1, path)
del path
import logging
from conf import app_config
from controller import rest_controller
from applog import my_logger as log_utils
_logger = logging.getLogger(__name__)
@log_utils.debug_enabled(_logger)
def run():
"""Run the WSGI server"""
host = app_config.SERVER_HOST
port = app_config.SERVER_LISTEN_PORT
_logger.info(f"# WSGI server listening at {host}:{port}")
uvicorn.run(rest_controller.app(), host=host, port=port)
if __name__ == "__main__":
run()