mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
refactor(app): restructure project to avoid circular imports
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from app.startup.module_initializer import start_modules, shutdown_modules
|
||||
from app.startup.routers import init_routers
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
"""
|
||||
定义应用的生命周期事件
|
||||
"""
|
||||
print("Starting up...")
|
||||
start_modules(app)
|
||||
init_routers(app)
|
||||
yield
|
||||
print("Shutting down...")
|
||||
shutdown_modules(app)
|
||||
Reference in New Issue
Block a user