Files
mini_code/models/__init__.py

24 lines
461 B
Python
Raw Normal View History

2025-12-01 17:22:53 +08:00
import pymysql
from peewee import MySQLDatabase
# 安装 pymysql 作为 MySQLdb
pymysql.install_as_MySQLdb()
# 数据库配置
db_config = {
'database': 'lm',
'user': 'lm',
2026-02-03 13:09:01 +08:00
'password': 'sAn5MfjKApiTBrx4',
'host': '172.16.197.130',
2025-12-01 17:22:53 +08:00
'port': 3306
}
# 全局数据库实例
db = MySQLDatabase(
db_config['database'],
user=db_config['user'],
password=db_config['password'],
host=db_config['host'],
port=db_config['port']
)