-
Notifications
You must be signed in to change notification settings - Fork 47
/
main.py
41 lines (33 loc) · 1.1 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
from os import environ
from maintools import initialize_before_launch
if __name__ == "__mp_main__":
"""Option 1: Skip section for multiprocess spawning
This section will be skipped when running in multiprocessing mode"""
pass
elif __name__ == "__main__":
#
"""Option 2: Debug mode
Running this file directly to debug the app
Run this section if you don't want to run app in docker"""
if environ.get("API_ENV") != "test":
environ["API_ENV"] = "local"
environ["DOCKER_MODE"] = "False"
import uvicorn
from app.common.app_settings import create_app
from app.common.config import config
initialize_before_launch()
app = create_app(config=config)
uvicorn.run(
app,
host="0.0.0.0",
port=config.port,
)
else:
"""Option 3: Non-debug mode
Docker will run this section as the main entrypoint
This section will mostly be used.
Maybe LLaMa won't work in Docker."""
from app.common.app_settings import create_app
from app.common.config import config
initialize_before_launch()
app = create_app(config=config)