You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
884 B

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()