from fastapi import FastAPI from tortoise.contrib.fastapi import register_tortoise from .setting import setting def register_mysql(app: FastAPI): register_tortoise( app, config={ "connections": { "default": setting.DB_URL }, "apps": { "models": { "models": ["aerich.models", "models"], "default_connection": "default" } }, 'use_tz': False, 'timezone': setting.TIMEZONE }, generate_schemas=False, add_exception_handlers=False, )