-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_server.py
More file actions
40 lines (31 loc) · 1.06 KB
/
run_server.py
File metadata and controls
40 lines (31 loc) · 1.06 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
"""
run_server.py
=============
Launch the PLC Conveyor Sortation HMI server.
Usage:
python run_server.py
python run_server.py --port 8080
python run_server.py --host 0.0.0.0 --port 8080
Opens http://localhost:8080 in your browser.
"""
import argparse
import uvicorn
def main():
parser = argparse.ArgumentParser(description="PLC Conveyor Sortation Server")
parser.add_argument("--host", default="127.0.0.1", help="Bind host (default: 127.0.0.1)")
parser.add_argument("--port", type=int, default=8080, help="Bind port (default: 8080)")
parser.add_argument("--reload", action="store_true", help="Enable auto-reload for development")
args = parser.parse_args()
print(f"Starting PLC Conveyor Sortation Server on http://{args.host}:{args.port}")
print("Press Ctrl+C to stop.")
import sys
from server.api import app
uvicorn.run(
app,
host=args.host,
port=args.port,
reload=args.reload and not getattr(sys, 'frozen', False),
log_level="info",
)
if __name__ == "__main__":
main()