Spaces:
Sleeping
Sleeping
Claude Code Claude Opus 4.6 commited on
Commit ·
3eb8441
1
Parent(s): e3aa6b2
Claude Code: Fix startup - add explicit uvicorn.run() with logging
Browse files- Add main block with uvicorn.run(app, host="0.0.0.0", port=7860)
- Add explicit logging before server binding to verify execution
- Ensure server binds to port 7860 regardless of agent status
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -246,3 +246,15 @@ def get_agents():
|
|
| 246 |
"detail": "Cain is operational",
|
| 247 |
"authStatus": "approved",
|
| 248 |
}]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
"detail": "Cain is operational",
|
| 247 |
"authStatus": "approved",
|
| 248 |
}]
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
# CRITICAL: Main block to ensure uvicorn.run() executes immediately
|
| 252 |
+
# This ensures server binds to 0.0.0.0:7860 regardless of agent initialization
|
| 253 |
+
if __name__ == "__main__":
|
| 254 |
+
import uvicorn
|
| 255 |
+
logger.info("[MAIN] Starting uvicorn server directly - binding to 0.0.0.0:7860")
|
| 256 |
+
logger.info(f"[MAIN] STARTUP_MODE={STARTUP_MODE}")
|
| 257 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
| 258 |
+
else:
|
| 259 |
+
# Module import path (via entrypoint.sh: uvicorn app:app)
|
| 260 |
+
logger.info("[MAIN] App module imported - FastAPI app created, waiting for uvicorn to bind")
|