forked from xiyan520/MHTI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_server.py
More file actions
42 lines (34 loc) · 992 Bytes
/
Copy pathrun_server.py
File metadata and controls
42 lines (34 loc) · 992 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
36
37
38
39
40
41
42
#!/usr/bin/env python
"""Server startup script with configurable host and port."""
import argparse
import uvicorn
def main():
parser = argparse.ArgumentParser(description="MHTI Server")
parser.add_argument(
"--host",
default="127.0.0.1",
help="Host to bind (default: 127.0.0.1, use 0.0.0.0 for LAN access)",
)
parser.add_argument(
"--port",
type=int,
default=8000,
help="Port to bind (default: 8000)",
)
parser.add_argument(
"--reload",
action="store_true",
help="Enable auto-reload for development",
)
args = parser.parse_args()
print(f"Starting server at http://{args.host}:{args.port}")
if args.host == "0.0.0.0":
print("LAN access enabled - accessible from other devices on the network")
uvicorn.run(
"server.main:app",
host=args.host,
port=args.port,
reload=args.reload,
)
if __name__ == "__main__":
main()