-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.py
More file actions
executable file
·64 lines (54 loc) · 1.83 KB
/
dev.py
File metadata and controls
executable file
·64 lines (54 loc) · 1.83 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
#!/usr/bin/env python3
"""
Development server with hot reload for the Exo Proxy Server.
This script provides better hot reload configuration for development.
"""
import subprocess
import sys
import os
from pathlib import Path
def main():
"""Start the development server with optimized hot reload."""
project_root = Path(__file__).parent
# Ensure we're in the project root
os.chdir(project_root)
# Check if virtual environment exists
venv_path = project_root / "venv" / "bin" / "activate"
if not venv_path.exists():
print("❌ Virtual environment not found. Please run setup first.")
sys.exit(1)
# Command to run uvicorn with optimized hot reload
cmd = [
"uvicorn",
"app.main:app",
"--host", "0.0.0.0",
"--port", "8000",
"--reload",
"--reload-delay", "0.1", # Faster reload response
"--reload-include", "*.py",
"--reload-include", "*.html",
"--reload-include", "*.css",
"--reload-include", "*.js",
"--reload-include", "*.jinja2",
"--reload-exclude", "__pycache__",
"--reload-exclude", "*.pyc",
"--reload-exclude", ".git",
"--log-level", "info"
]
print("🚀 Starting Exo Proxy Server with Hot Reload")
print("=" * 50)
print("📁 Watching files: *.py, *.html, *.css, *.js, *.jinja2")
print("🌐 Server: http://localhost:8000")
print("🔄 Hot reload: ENABLED (0.1s delay)")
print("🛑 Press Ctrl+C to stop")
print("=" * 50)
# Run the command
try:
subprocess.run(cmd, check=True)
except KeyboardInterrupt:
print("\n👋 Server stopped by user")
except subprocess.CalledProcessError as e:
print(f"❌ Server failed with exit code: {e.returncode}")
sys.exit(e.returncode)
if __name__ == "__main__":
main()