-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·49 lines (39 loc) · 1.09 KB
/
run.py
File metadata and controls
executable file
·49 lines (39 loc) · 1.09 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
49
import subprocess
import sys
import os
import signal
ROOT = os.path.dirname(os.path.abspath(__file__))
def main():
procs = []
try:
# Start backend
backend = subprocess.Popen(
[
sys.executable, "-m", "uvicorn",
"backend.main:app",
"--reload",
"--port", "8005",
],
cwd=ROOT,
)
procs.append(backend)
# Start frontend
frontend = subprocess.Popen(
["npm", "run", "dev"],
cwd=os.path.join(ROOT, "frontend"),
)
procs.append(frontend)
print("Backend: http://localhost:8005")
print("Frontend: http://localhost:8081")
print("Press Ctrl+C to stop both.\n")
# Wait for either to exit
for p in procs:
p.wait()
except KeyboardInterrupt:
print("\nShutting down...")
for p in procs:
p.send_signal(signal.SIGTERM)
for p in procs:
p.wait()
if __name__ == "__main__":
main()