Files
ca_auto_table/back/settings.py

35 lines
1.2 KiB
Python
Raw Permalink Normal View History

2025-11-18 16:46:04 +08:00
TORTOISE_ORM = {
'connections': {
'default': {
# 'engine': 'tortoise.backends.asyncpg', PostgreSQL
'engine': 'tortoise.backends.mysql', # MySQL or Mariadb
'credentials': {
'host': '192.168.11.67',
'port': 3306,
'user': 'country',
'password': 'sWdFeXMmAbHE5MXj',
'database': 'country',
'minsize': 10, # 最小连接数设为10避免连接过多
'maxsize': 30, # 最大连接数设为30避免超出数据库限制
'charset': 'utf8mb4',
"echo": False,
'pool_recycle': 3600, # 增加连接回收时间从300秒到3600秒(1小时)
'connect_timeout': 10, # 连接超时时间
}
},
},
'apps': {
'models': {
# 仅注册实际存在的模型模块,移除不存在的 apis.project.models避免 Aerich 初始化失败
'models': [
"apis.country.models",
"aerich.models"
],
'default_connection': 'default',
}
},
'use_tz': False,
'timezone': 'Asia/Shanghai'
}