From 4f29c98daf79b0dcae60195a1419ed5acf0455bc Mon Sep 17 00:00:00 2001 From: Philip Cheung Date: Mon, 7 Oct 2024 17:17:06 +0800 Subject: [PATCH] path updated --- backend/app/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/app/main.py b/backend/app/main.py index f6e7c42..d941db2 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -1,4 +1,5 @@ import sentry_sdk +import os from fastapi import FastAPI from fastapi.routing import APIRoute from starlette.middleware.cors import CORSMiddleware @@ -18,8 +19,12 @@ app = FastAPI( title=settings.PROJECT_NAME, openapi_url=f"{settings.API_V1_STR}/openapi.json", generate_unique_id_function=custom_generate_unique_id, + ) -app.mount("/static", StaticFiles(directory="static"), name="static") +# app.mount("/static", StaticFiles(directory="static"), name="static") +script_dir = os.path.dirname(__file__) +st_abs_file_path = os.path.join(script_dir, "static/") +app.mount("/static", StaticFiles(directory=st_abs_file_path), name="static") # Set all CORS enabled origins if settings.BACKEND_CORS_ORIGINS: app.add_middleware(