update:修改文件结构,存储文件不再暴露,自定义数据都放在/data文件夹,方便docker

This commit is contained in:
lan
2022-12-13 22:06:29 +08:00
parent a5ddb6fc74
commit 44dd41573c
5 changed files with 15 additions and 13 deletions
+3 -2
View File
@@ -22,8 +22,9 @@ app = FastAPI(debug=settings.DEBUG)
DATA_ROOT = Path(settings.DATA_ROOT)
if not DATA_ROOT.exists():
DATA_ROOT.mkdir(parents=True)
# 静态文件夹
app.mount(settings.STATIC_URL, StaticFiles(directory=DATA_ROOT), name="static")
# 静态文件夹,这个固定就行了,静态资源都放在这里
app.mount(settings.STATIC_URL, StaticFiles(directory='./static'), name="static")
@app.on_event('startup')