数据库连接配置

parent 769e29e5
...@@ -27,7 +27,7 @@ tamp_user_engine = create_engine( ...@@ -27,7 +27,7 @@ tamp_user_engine = create_engine(
db=config[env]['MySQL']['tamp_user_db'], db=config[env]['MySQL']['tamp_user_db'],
host=config[env]['MySQL']['host'], host=config[env]['MySQL']['host'],
port=config[env]['MySQL']['port'], port=config[env]['MySQL']['port'],
user=config[env]['MySQL']['user2'], user=config[env]['MySQL']['user'],
password=config[env]['MySQL']['password'], password=config[env]['MySQL']['password'],
charset="utf8" charset="utf8"
), ),
...@@ -36,6 +36,22 @@ tamp_user_engine = create_engine( ...@@ -36,6 +36,22 @@ tamp_user_engine = create_engine(
pool_timeout=5, pool_timeout=5,
pool_recycle=600 pool_recycle=600
) )
if env == 'prod':
tamp_user_engine = create_engine(
'mysql+pymysql://{user}:{password}@{host}:{port}/{db}?charset={charset}'.format(
db=config[env]['MySQL']['tamp_user_db'],
host=config[env]['MySQL']['host'],
port=config[env]['MySQL']['port'],
user=config[env]['MySQL']['user2'],
password=config[env]['MySQL']['password'],
charset="utf8"
),
max_overflow=0, # 超过连接池大小外最多创建的连接
pool_size=100, # 连接池大小
pool_timeout=5,
pool_recycle=600
)
tamp_pay_engine = create_engine( tamp_pay_engine = create_engine(
'mysql+pymysql://{user}:{password}@{host}:{port}/{db}?charset={charset}'.format( 'mysql+pymysql://{user}:{password}@{host}:{port}/{db}?charset={charset}'.format(
db=config[env]['MySQL']['tamp_pay_db'], db=config[env]['MySQL']['tamp_pay_db'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment