| .. | .. |
|---|
| 51 | 51 | app.include_router(system.router, prefix="/api/system", tags=["system"]) |
|---|
| 52 | 52 | |
|---|
| 53 | 53 | # --------------------------------------------------------------------------- |
|---|
| 54 | | -# Static files – serve the frontend SPA at / |
|---|
| 55 | | -# Mount last so API routes take precedence |
|---|
| 54 | +# Static files – serve CSS/JS at /static and HTML at / |
|---|
| 55 | +# Mount /static first for explicit asset paths, then / for SPA fallback |
|---|
| 56 | 56 | # --------------------------------------------------------------------------- |
|---|
| 57 | 57 | if _STATIC_DIR.exists(): |
|---|
| 58 | + app.mount("/static", StaticFiles(directory=str(_STATIC_DIR)), name="static-assets") |
|---|
| 58 | 59 | app.mount("/", StaticFiles(directory=str(_STATIC_DIR), html=True), name="static") |
|---|
| 59 | 60 | else: |
|---|
| 60 | 61 | logger.warning("Static directory not found at %s – frontend will not be served", _STATIC_DIR) |
|---|