Spaces:
Sleeping
Sleeping
Claude Code Claude Opus 4.6 commited on
Commit ·
3af5388
1
Parent(s): b8f337d
Claude Code: Add /_debug diagnostic route to expose filesystem state
Browse files- Adds /_debug endpoint to verify server responsiveness
- Returns cwd, frontend existence, frontend listing, static mount status
- Helps diagnose root route / static file issues
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -72,6 +72,16 @@ async def lifespan(app: FastAPI):
|
|
| 72 |
app = FastAPI(lifespan=lifespan)
|
| 73 |
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
class LoggingMiddleware(BaseHTTPMiddleware):
|
| 76 |
"""Middleware to log all requests and capture full tracebacks on errors."""
|
| 77 |
|
|
|
|
| 72 |
app = FastAPI(lifespan=lifespan)
|
| 73 |
|
| 74 |
|
| 75 |
+
@app.get("/_debug")
|
| 76 |
+
def debug_info():
|
| 77 |
+
return {
|
| 78 |
+
"cwd": os.getcwd(),
|
| 79 |
+
"frontend_exists": os.path.exists("frontend"),
|
| 80 |
+
"ls_front": os.listdir("frontend") if os.path.exists("frontend") else [],
|
| 81 |
+
"static_mounted": any(m.path == "/" for m in app.routes)
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
|
| 85 |
class LoggingMiddleware(BaseHTTPMiddleware):
|
| 86 |
"""Middleware to log all requests and capture full tracebacks on errors."""
|
| 87 |
|