-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapi.py
23 lines (22 loc) · 1016 Bytes
/
api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import uvicorn
import ssl
from Backend.app import config
if __name__=="__main__":
if config.settings.RUN_ON_HTTPS:
uvicorn.run("Backend.app.app:app",
host=config.settings.HOST,
port=config.settings.PORT,
reload=config.settings.DEBUG_MODE,
ssl_version=ssl.PROTOCOL_SSLv23,
# cert_reqs=ssl.CERT_OPTIONAL,
ssl_keyfile=config.settings.BACKEND_SSL_KEY_FILE, # Manually Generated certificates
ssl_certfile=config.settings.BACKEND_SSL_CRT_FILE, # are used here
)
else:
uvicorn.run("Backend.app.app:app",
host=config.settings.HOST,
port=config.settings.PORT,
reload=config.settings.DEBUG_MODE,
)
#Location is specified as app/test.py and it is the main fastapi file
#HOST, PORT and DEBUG_MODE can be configured in config.py