Spaces:
Sleeping
Sleeping
Align backend startup port to environment configuration
Browse files- backend/app/main.py +4 -2
backend/app/main.py
CHANGED
|
@@ -240,8 +240,9 @@ async def startup_event():
|
|
| 240 |
print_route(r)
|
| 241 |
except Exception as e:
|
| 242 |
robust_print(f"[ROUTES] debug failed: {e}")
|
|
|
|
| 243 |
robust_print("-" * 50, flush=True)
|
| 244 |
-
robust_print("FakeShield API is now ONLINE and listening on port
|
| 245 |
robust_print("-" * 50, flush=True)
|
| 246 |
|
| 247 |
@app.get("/")
|
|
@@ -255,5 +256,6 @@ def root():
|
|
| 255 |
|
| 256 |
if __name__ == "__main__":
|
| 257 |
import uvicorn
|
| 258 |
-
|
|
|
|
| 259 |
|
|
|
|
| 240 |
print_route(r)
|
| 241 |
except Exception as e:
|
| 242 |
robust_print(f"[ROUTES] debug failed: {e}")
|
| 243 |
+
port = int(os.environ.get("PORT", os.environ.get("API_PORT", "7860")))
|
| 244 |
robust_print("-" * 50, flush=True)
|
| 245 |
+
robust_print(f"FakeShield API is now ONLINE and listening on port {port}.", flush=True)
|
| 246 |
robust_print("-" * 50, flush=True)
|
| 247 |
|
| 248 |
@app.get("/")
|
|
|
|
| 256 |
|
| 257 |
if __name__ == "__main__":
|
| 258 |
import uvicorn
|
| 259 |
+
port = int(os.environ.get("PORT", os.environ.get("API_PORT", "7860")))
|
| 260 |
+
uvicorn.run(app, host="0.0.0.0", port=port)
|
| 261 |
|