42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
# 실행 방법
|
|
# pip install -r requirements.txt
|
|
# python web_main.py # 기본 local 환경
|
|
# APP_ENV=dev python web_main.py # 환경 지정
|
|
#
|
|
# 또는 uvicorn 직접 실행:
|
|
# uvicorn router.router:app --reload --host=0.0.0.0 --port=9500
|
|
|
|
import uvicorn
|
|
|
|
from common.logger import LOG
|
|
from config.server_configs import web_server_config
|
|
|
|
LOG.SetPrefix(web_server_config.server_name)
|
|
|
|
# import 시점에 app 및 DB 세션 매니저(싱글톤)가 초기화된다.
|
|
import router.router
|
|
|
|
if __name__ == "__main__":
|
|
LOG.i(f"Server Name : {web_server_config.server_name}")
|
|
LOG.i(f"Server Port : {web_server_config.port}")
|
|
LOG.i(f"API Server start time : {router.router.API_SERVER_START_TIME}")
|
|
|
|
if web_server_config.is_ssl:
|
|
uvicorn.run(
|
|
"router.router:app",
|
|
host="0.0.0.0",
|
|
port=web_server_config.port,
|
|
access_log=False,
|
|
workers=web_server_config.process_count,
|
|
ssl_keyfile="./SSL/key.pem",
|
|
ssl_certfile="./SSL/cert.pem",
|
|
)
|
|
else:
|
|
uvicorn.run(
|
|
"router.router:app",
|
|
host="0.0.0.0",
|
|
port=web_server_config.port,
|
|
access_log=False,
|
|
workers=web_server_config.process_count,
|
|
)
|