back to static

This commit is contained in:
Philip Cheung 2024-10-07 21:04:36 +08:00
parent 5897b5a403
commit ffbe18559d
1 changed files with 12 additions and 2 deletions

View File

@ -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(