V2.0.0-alpha2 2025-05-13
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
# Findreve 更新日志
|
# Findreve 更新日志
|
||||||
|
|
||||||
|
## V2.0.0-alpha2 2025-05-13
|
||||||
|
> 注意,这是一个非常不稳定的早期测试版,可能存在着非常多的问题。请勿在生产环境中使用。
|
||||||
|
|
||||||
|
- 修复 后端请求也发送给前端请求
|
||||||
|
- 修复 访问 Swagger UI 文档时报 Warning 问题
|
||||||
|
|
||||||
## V2.0.0-alpha1 2025-04-22
|
## V2.0.0-alpha1 2025-04-22
|
||||||
> 注意,这是一个非常不稳定的早期测试版,可能存在着非常多的问题。请勿在生产环境中使用。
|
> 注意,这是一个非常不稳定的早期测试版,可能存在着非常多的问题。请勿在生产环境中使用。
|
||||||
|
|
||||||
|
|||||||
11
app.py
11
app.py
@@ -2,8 +2,12 @@ from fastapi import FastAPI
|
|||||||
from fastapi.responses import FileResponse
|
from fastapi.responses import FileResponse
|
||||||
from fastapi import Request, HTTPException
|
from fastapi import Request, HTTPException
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
|
from routes import (session, admin, object)
|
||||||
import model.database
|
import model.database
|
||||||
import os
|
import os, asyncio
|
||||||
|
|
||||||
|
# 初始化数据库
|
||||||
|
asyncio.run(model.database.Database().init_db())
|
||||||
|
|
||||||
# 定义程序参数
|
# 定义程序参数
|
||||||
APP_NAME: str = 'Findreve'
|
APP_NAME: str = 'Findreve'
|
||||||
@@ -31,6 +35,11 @@ app = FastAPI(
|
|||||||
lifespan=lifespan
|
lifespan=lifespan
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 挂载后端路由
|
||||||
|
app.include_router(admin.Router)
|
||||||
|
app.include_router(session.Router)
|
||||||
|
app.include_router(object.Router)
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
def read_root():
|
def read_root():
|
||||||
return FileResponse("dist/index.html")
|
return FileResponse("dist/index.html")
|
||||||
|
|||||||
9
main.py
9
main.py
@@ -11,15 +11,8 @@ Copyright (c) 2018-2025 by 于小丘Yuerchu, All Rights Reserved.
|
|||||||
# 导入库
|
# 导入库
|
||||||
from app import app
|
from app import app
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
|
||||||
from routes import (session, admin, object)
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# 挂载路由
|
|
||||||
app.include_router(admin.Router)
|
|
||||||
app.include_router(session.Router)
|
|
||||||
app.include_router(object.Router)
|
|
||||||
|
|
||||||
# 添加静态文件目录
|
# 添加静态文件目录
|
||||||
try:
|
try:
|
||||||
# 挂载静态文件目录
|
# 挂载静态文件目录
|
||||||
@@ -31,7 +24,7 @@ except RuntimeError as e:
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import uvicorn
|
import uvicorn
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
'main:app',
|
'app:app',
|
||||||
host='0.0.0.0',
|
host='0.0.0.0',
|
||||||
port=8080,
|
port=8080,
|
||||||
reload=True)
|
reload=True)
|
||||||
Reference in New Issue
Block a user