Files
tg_code/models/__init__.py
Administrator 37e9d4038c gfregfregfr
2025-11-12 12:50:39 +08:00

24 lines
455 B
Python

import pymysql
from peewee import MySQLDatabase
# 安装 pymysql 作为 MySQLdb
pymysql.install_as_MySQLdb()
# 数据库配置
db_config = {
'database': 'hx',
'user': 'hx',
'password': 'haxi@123456',
'host': '192.168.11.30',
'port': 3306
}
# 全局数据库实例
db = MySQLDatabase(
db_config['database'],
user=db_config['user'],
password=db_config['password'],
host=db_config['host'],
port=db_config['port']
)