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.
26 lines
639 B
26 lines
639 B
4 months ago
|
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,
|
||
|
)
|