from tortoise import Tortoise, run_async async def init(): # Here we create a SQLite DB using file "db.sqlite3" # also specify the app name of "models" # which contain models from "app.models" await Tortoise.init( config={ "connections": { "default": "mysql://root:123456@127.0.0.1:3306/scheduler?charset=utf8mb4" }, "apps": { "scheduler": { "models": ["aerich.models", "models"], "default_connection": "default" } }, 'use_tz': False, # 'timezone': setting.TIMEZONE } ) # Generate the schema # await Tortoise.generate_schemas() # run_async is a helper function to run simple async Tortoise scripts. run_async(init()) from models.user import User User.all().count() exit()