JakgritB Claude Sonnet 4.6 commited on
Commit
cf17161
·
1 Parent(s): f066cd2

fix(hf-space): fix static dir path for SPA catch-all route

Browse files

Path(__file__).parent.parent resolves to /app in the container
(/app/app/main.py -> /app/app -> /app), so /app/static is found
correctly and the React SPA catch-all route gets registered.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. backend/app/main.py +1 -1
backend/app/main.py CHANGED
@@ -34,7 +34,7 @@ app.add_middleware(
34
  )
35
  app.mount("/media", StaticFiles(directory=settings.storage_dir), name="media")
36
 
37
- _STATIC_DIR = Path(__file__).parent.parent.parent / "static"
38
  if _STATIC_DIR.is_dir():
39
  app.mount("/assets", StaticFiles(directory=_STATIC_DIR / "assets"), name="frontend-assets")
40
 
 
34
  )
35
  app.mount("/media", StaticFiles(directory=settings.storage_dir), name="media")
36
 
37
+ _STATIC_DIR = Path(__file__).parent.parent / "static"
38
  if _STATIC_DIR.is_dir():
39
  app.mount("/assets", StaticFiles(directory=_STATIC_DIR / "assets"), name="frontend-assets")
40