Spaces:
Runtime error
Runtime error
Upload 4 files
Browse files- app.py +10 -3
- templates/.gitkeep +1 -0
app.py
CHANGED
|
@@ -255,11 +255,18 @@ TEMPLATES_DIR = Path(__file__).parent / "templates"
|
|
| 255 |
|
| 256 |
@app.get("/", response_class=HTMLResponse)
|
| 257 |
async def root():
|
| 258 |
-
"""Serve the main index page"""
|
| 259 |
index_path = TEMPLATES_DIR / "index.html"
|
| 260 |
if index_path.exists():
|
| 261 |
-
return FileResponse(index_path)
|
| 262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
|
| 264 |
@app.get("/test", response_class=HTMLResponse)
|
| 265 |
async def test_page():
|
|
|
|
| 255 |
|
| 256 |
@app.get("/", response_class=HTMLResponse)
|
| 257 |
async def root():
|
| 258 |
+
"""Serve the main index page (ignores query parameters like ?logs=container)"""
|
| 259 |
index_path = TEMPLATES_DIR / "index.html"
|
| 260 |
if index_path.exists():
|
| 261 |
+
return FileResponse(index_path, media_type="text/html")
|
| 262 |
+
# Return error with debug info
|
| 263 |
+
return HTMLResponse(
|
| 264 |
+
f"<h1>Error: Template not found</h1>"
|
| 265 |
+
f"<p>Looking for: {index_path}</p>"
|
| 266 |
+
f"<p>Exists: {index_path.exists()}</p>"
|
| 267 |
+
f"<p>Current dir: {Path(__file__).parent}</p>",
|
| 268 |
+
status_code=404
|
| 269 |
+
)
|
| 270 |
|
| 271 |
@app.get("/test", response_class=HTMLResponse)
|
| 272 |
async def test_page():
|
templates/.gitkeep
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# This file ensures the templates directory is included in git and Hugging Face Space deployments
|