Skip to content

Commit b38b691

Browse files
committed
fix start error in first time
1 parent 4803ce6 commit b38b691

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

backend/src/module/core/program.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import logging
22

33
from module.conf import VERSION, settings
4-
from module.update import (
5-
first_run,
6-
start_up,
7-
)
84

95
from .aiocore import app_core
106
from .status import ProgramStatus
@@ -41,16 +37,18 @@ def __start_info():
4137
async def startup(self):
4238
self.__start_info()
4339
if not self.program_status.database:
40+
from module.update import first_run
41+
4442
first_run()
4543
logger.info("[Core] No db file exists, create database file.")
46-
return {"status": "First run detected."}
4744

4845
from module.database import check_and_upgrade_database
4946

5047
if not check_and_upgrade_database():
5148
logger.error("数据库升级失败,程序无法启动")
5249
raise RuntimeError("数据库升级失败")
5350

51+
# 检查是否需要创建图片缓存目录
5452
self.program_status.img_cache
5553
await self.start()
5654

@@ -81,5 +79,6 @@ def update_database(self):
8179
if not self.program_status.version_update:
8280
return {"status": "No update found."}
8381
else:
82+
from module.update import start_up
8483
start_up()
8584
return {"status": "Database updated."}

0 commit comments

Comments
 (0)