-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
35 lines (28 loc) · 690 Bytes
/
server.py
File metadata and controls
35 lines (28 loc) · 690 Bytes
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 argparse
import sys
import uvicorn
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Start a web server")
parser.add_argument(
"--host",
type=str,
default="localhost",
help="host bind the server to (default: localhost)"
)
parser.add_argument(
"--port",
type=int,
default=8080,
help="port bind the server to (default: 8080)"
)
args = parser.parse_args()
try:
uvicorn.run(
"src.main:app",
host=args.host,
port=args.port,
reload=True
)
except Exception as e:
print(e)
sys.exit(1)