sleep1223 / fast-soy-admin

基于 FastAPI+Vue3+Naive UI 的现代化轻量管理平台。 A modern Management Platform based on FastAPI+Vue3+Naive UI.
https://fast-soy-admin2.sleep0.de/
MIT License
91 stars 19 forks source link

在正式部署的时候,modify_db, init_xxx就不需要执行了,请教需要怎么调整 #5

Open kanbang opened 1 month ago

kanbang commented 1 month ago
@asynccontextmanager
async def lifespan(_app: FastAPI):
    start_time = time.time()
    try:
        await modify_db()
        await init_menus()
        await refresh_api_list()
        await init_users()
        await Log.create(log_type=LogType.SystemLog, log_detail_type=LogDetailType.SystemStart)

        yield
    finally:

        end_time = time.time()
        runtime = end_time - start_time
        logger.info(f"App {_app.title} runtime: {runtime} seconds")  # noqa
        await Log.create(log_type=LogType.SystemLog, log_detail_type=LogDetailType.SystemStop)

直接去掉这些代码,会报错误

sleep1223 commented 1 month ago

保留即可, 函数里有判断是否需要执行初始化 部分数据库需要modify_db里的commend.init来阻塞等待连接数据库成功

kanbang commented 3 weeks ago

谢谢,大佬,咱们的前端有更新soybean-admin新版的计划吗