-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
35 lines (25 loc) · 1019 Bytes
/
run.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
import uvicorn
from fastapi import HTTPException
from test_app import test_db_route
from utils.logger import logger
async def _run_server():
# todo FOR LOCAL LAUNCH
# from utils.env import get_env
# try:
# await get_env()
# except Exception as e:
# logger.error(f"An error occurred when get env variables | {e}")
# raise HTTPException(status_code=500, detail=f"An error occurred when get env variables | {e}")
try:
from test_app import test_main_route
await test_main_route()
await test_db_route()
logger.info("The application test has been successfully executed")
except Exception as e:
logger.error(f"An error occurred when running tests | {e}")
raise HTTPException(status_code=500, detail=f"An error occurred when running tests | {e}")
uvicorn_cmd = "app:app"
uvicorn.run(uvicorn_cmd, host="0.0.0.0", port=8001, reload=True)
if __name__ == "__main__":
import asyncio
asyncio.run(_run_server())