Refactor code structure for improved readability and maintainability
This commit is contained in:
7
main.py
7
main.py
@@ -5,19 +5,12 @@ from models.database import init_db
|
||||
from models.migration import migration
|
||||
from pkg.lifespan import lifespan
|
||||
from pkg.JWT import jwt as JWT
|
||||
from pkg.log import set_log_level
|
||||
|
||||
# 添加初始化数据库启动项
|
||||
lifespan.add_startup(init_db)
|
||||
lifespan.add_startup(migration)
|
||||
lifespan.add_startup(JWT.load_secret_key)
|
||||
|
||||
# 设置日志等级
|
||||
if appmeta.debug:
|
||||
set_log_level('DEBUG')
|
||||
else:
|
||||
set_log_level('INFO')
|
||||
|
||||
# 创建应用实例并设置元数据
|
||||
app = FastAPI(
|
||||
title=appmeta.APP_NAME,
|
||||
|
||||
Reference in New Issue
Block a user