update run.py
Browse files
run.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Simple entry point to run the 1proxy backend server.
|
| 4 |
+
Usage: python run.py
|
| 5 |
+
"""
|
| 6 |
+
import os
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
# Load environment variables from .env file
|
| 10 |
+
try:
|
| 11 |
+
from dotenv import load_dotenv
|
| 12 |
+
env_path = Path(__file__).parent / '.env'
|
| 13 |
+
load_dotenv(dotenv_path=env_path)
|
| 14 |
+
print(f"✅ Loaded environment from: {env_path}")
|
| 15 |
+
except ImportError:
|
| 16 |
+
print("⚠️ python-dotenv not installed. Install with: pip install python-dotenv")
|
| 17 |
+
except Exception as e:
|
| 18 |
+
print(f"⚠️ Could not load .env file: {e}")
|
| 19 |
+
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
import uvicorn
|
| 22 |
+
|
| 23 |
+
print("🚀 Starting 1proxy Backend Server...")
|
| 24 |
+
print("🌐 Server will be available at: http://localhost:8000")
|
| 25 |
+
print("📚 API Documentation: http://localhost:8000/docs")
|
| 26 |
+
print("")
|
| 27 |
+
|
| 28 |
+
# Run the FastAPI app with hot reload
|
| 29 |
+
uvicorn.run(
|
| 30 |
+
"app.main:app",
|
| 31 |
+
host="0.0.0.0",
|
| 32 |
+
port=8000,
|
| 33 |
+
reload=True,
|
| 34 |
+
log_level="info"
|
| 35 |
+
)
|