From ffbe18559d2cf52e1c3d71422bc42bb9467fecd8 Mon Sep 17 00:00:00 2001 From: Philip Cheung Date: Mon, 7 Oct 2024 21:04:36 +0800 Subject: [PATCH] back to static --- backend/app/main.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/app/main.py b/backend/app/main.py index 507aaab..1f03d4f 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -1,5 +1,5 @@ import sentry_sdk -import os +from pathlib import Path from fastapi import FastAPI from fastapi.routing import APIRoute from starlette.middleware.cors import CORSMiddleware @@ -21,7 +21,17 @@ app = FastAPI( generate_unique_id_function=custom_generate_unique_id, ) -app.mount("/static", StaticFiles(directory="static"), name="static") +# app.mount("/static", StaticFiles(directory="static"), name="static") + + +current_file = Path(__file__) +current_file_dir = current_file.parent +project_root = current_file_dir.parent +project_root_absolute = project_root.resolve() +static_root_absolute = project_root_absolute / "static" + +app.mount("/static", static_root_absolute, name="static") + # Set all CORS enabled origins if settings.BACKEND_CORS_ORIGINS: app.add_middleware(