from fastapi.staticfiles import StaticFiles app = FastAPI() # 挂载 app.mount("/static", StaticFiles(directory="static"), name="static")
安装 pip install aiofiles
from fastapi.staticfiles import StaticFiles app = FastAPI() # 挂载 app.mount("/static", StaticFiles(directory="static"), name="static")
安装 pip install aiofiles