Spaces:
Runtime error
Runtime error
Upload main.py
Browse files
backend/rexpro_ai/main.py
CHANGED
|
@@ -2975,7 +2975,15 @@ async def check_db_health():
|
|
| 2975 |
|
| 2976 |
# --- static assets & files ---
|
| 2977 |
# Serve build-time static assets (CSS, JS, images, favicon, etc.)
|
| 2978 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2979 |
|
| 2980 |
|
| 2981 |
@app.get('/cache/{path:path}')
|
|
|
|
| 2975 |
|
| 2976 |
# --- static assets & files ---
|
| 2977 |
# Serve build-time static assets (CSS, JS, images, favicon, etc.)
|
| 2978 |
+
class CustomStaticFiles(StaticFiles):
|
| 2979 |
+
def __init__(self, *args, **kwargs):
|
| 2980 |
+
super().__init__(*args, **kwargs)
|
| 2981 |
+
frontend_static_dir = os.path.join(FRONTEND_BUILD_DIR, 'static')
|
| 2982 |
+
if os.path.exists(frontend_static_dir):
|
| 2983 |
+
if frontend_static_dir not in self.all_directories:
|
| 2984 |
+
self.all_directories.append(frontend_static_dir)
|
| 2985 |
+
|
| 2986 |
+
app.mount('/static', CustomStaticFiles(directory=STATIC_DIR), name='static')
|
| 2987 |
|
| 2988 |
|
| 2989 |
@app.get('/cache/{path:path}')
|