29 lines
809 B
Python
29 lines
809 B
Python
import taskiq_fastapi
|
|
from fastapi import FastAPI
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
import routers
|
|
from core import lifespan, settings, register_middlewares, register_exception_handlers
|
|
from task_management import broker
|
|
from utils.auto_include_routers import auto_include_routers
|
|
|
|
|
|
def create_app() -> FastAPI:
|
|
app = FastAPI(
|
|
separate_input_output_schemas=True,
|
|
default_response_class=settings.DEFAULT_RESPONSE_CLASS,
|
|
root_path=settings.ROOT_PATH,
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
register_middlewares(app)
|
|
register_exception_handlers(app)
|
|
auto_include_routers(app, routers, full_path=True)
|
|
app.mount("/static", StaticFiles(directory=settings.STATIC_DIR), name="static")
|
|
|
|
taskiq_fastapi.init(broker, "main:app")
|
|
return app
|
|
|
|
|
|
app = create_app()
|