File size: 653 Bytes
6609c06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3
"""
Dev launcher: starts FastAPI WS server (uvicorn) on 5001 and Streamlit app on 5050.
"""
import subprocess, sys, time, os

def main():
    env = os.environ.copy()
    env.setdefault("SYNC_SERVER_BASE", "http://localhost:5001")

    ws = subprocess.Popen([sys.executable, "-m", "uvicorn", "ws_server:app", "--host", "0.0.0.0", "--port", "5001"], env=env)
    time.sleep(1.5)
    try:
        st = subprocess.Popen([sys.executable, "-m", "streamlit", "run", "app.py", "--server.port", "5050", "--server.address", "localhost"], env=env)
        st.wait()
    finally:
        ws.terminate()

if __name__ == "__main__":
    main()