-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
48 lines (36 loc) · 1.03 KB
/
app.py
File metadata and controls
48 lines (36 loc) · 1.03 KB
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
42
43
44
45
46
47
48
import argparse
import gc
gc.collect()
ap = argparse.ArgumentParser()
if __name__ == "__main__":
from dotenv import load_dotenv
load_dotenv()
from jetpack.log_config import configure_logger
configure_logger()
import logging
from granian import Granian
from granian.constants import Interfaces
from scripts.constants.config import Services
ap.add_argument(
"--port",
"-p",
required=False,
default=Services.POST,
help="Port to start the application.",
)
ap.add_argument(
"--host",
"-H",
required=False,
default=Services.HOST,
help="Host to start the application.",
)
arguments = vars(ap.parse_args())
logging.info(f"Starting the application on {arguments['host']}:{arguments['port']}")
Granian(
"main:app",
address=arguments["host"],
port=arguments["port"],
interface=Interfaces.ASGI,
log_access=True,
).serve()