Start the backend server
(backend_dir: Path)
| 216 | |
| 217 | |
| 218 | def start_backend(backend_dir: Path): |
| 219 | """Start the backend server""" |
| 220 | global _backend_process |
| 221 | |
| 222 | print("🔧 Starting backend server...") |
| 223 | |
| 224 | # Use shell=True on Windows for proper command handling |
| 225 | if get_platform() == "windows": |
| 226 | _backend_process = subprocess.Popen( |
| 227 | f'"{sys.executable}" -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload', |
| 228 | cwd=backend_dir, |
| 229 | shell=True, |
| 230 | creationflags=subprocess.CREATE_NEW_PROCESS_GROUP, |
| 231 | ) |
| 232 | else: |
| 233 | _backend_process = subprocess.Popen( |
| 234 | [ |
| 235 | sys.executable, |
| 236 | "-m", |
| 237 | "uvicorn", |
| 238 | "main:app", |
| 239 | "--host", |
| 240 | "0.0.0.0", |
| 241 | "--port", |
| 242 | "8000", |
| 243 | "--reload", |
| 244 | ], |
| 245 | cwd=backend_dir, |
| 246 | start_new_session=True, # Create new process group |
| 247 | ) |
| 248 | |
| 249 | # Wait for backend to start |
| 250 | time.sleep(2) |
| 251 | |
| 252 | if _backend_process.poll() is None: |
| 253 | print("✅ Backend started: http://localhost:8000") |
| 254 | return True |
| 255 | else: |
| 256 | print("❌ Backend failed to start") |
| 257 | return False |
| 258 | |
| 259 | |
| 260 | def start_frontend(frontend_dir: Path): |