-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_app.py
More file actions
executable file
·73 lines (60 loc) · 2.15 KB
/
start_app.py
File metadata and controls
executable file
·73 lines (60 loc) · 2.15 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python3
"""
Complete startup script for the Academic Review Simulator
Starts both the FastAPI backend and React frontend
"""
import os
import sys
import time
import subprocess
import threading
from pathlib import Path
def start_backend():
"""Start the FastAPI backend server"""
backend_dir = Path(__file__).parent / "backend"
os.chdir(backend_dir)
print("🚀 Starting FastAPI Backend on port 8000...")
try:
subprocess.run([
sys.executable, "-m", "uvicorn", "main:app",
"--host", "0.0.0.0",
"--port", "8000",
"--reload"
], cwd=backend_dir)
except KeyboardInterrupt:
print("\n👋 Backend server stopped")
def start_frontend():
"""Start the React frontend development server"""
frontend_dir = Path(__file__).parent / "frontend"
print("🚀 Starting React Frontend on port 3000...")
# Check if node_modules exists
node_modules = frontend_dir / "node_modules"
if not node_modules.exists():
print("📦 Installing frontend dependencies...")
subprocess.run(["npm", "install"], cwd=frontend_dir)
try:
subprocess.run(["npm", "run", "dev"], cwd=frontend_dir)
except KeyboardInterrupt:
print("\n👋 Frontend server stopped")
if __name__ == "__main__":
print("🎓 Academic Review Simulator v2.0")
print("=" * 50)
print("📋 Backend API: http://localhost:8000")
print("📋 API Docs: http://localhost:8000/docs")
print("📋 Frontend: http://localhost:3000")
print("=" * 50)
print()
# Create upload directory if it doesn't exist
uploads_dir = Path(__file__).parent / "backend" / "uploads"
uploads_dir.mkdir(exist_ok=True)
try:
# Start backend in a separate thread
backend_thread = threading.Thread(target=start_backend, daemon=True)
backend_thread.start()
# Give backend time to start
time.sleep(3)
# Start frontend (this will block)
start_frontend()
except KeyboardInterrupt:
print("\n👋 Shutting down Academic Review Simulator...")
sys.exit(0)