Commit f9f2cf59 authored by 张晓彤's avatar 张晓彤

修复数据库链接BUG

parent d9c18bb7
......@@ -92,19 +92,31 @@ redis2 = StrictRedis(connection_pool=pool2)
# 创建对象的基类:
Base = declarative_base()
sql_str = str("mysql+mysqlconnector://" + mysql_config["user"] + ":%s@" + mysql_config["host"] + \
":" + mysql_config["port"] + "/" + mysql_config["database"])
postgre_str = str("postgresql://" + postgre_config["user"] + ":%s@" + postgre_config["host"] + \
":" + postgre_config["port"] + "/" + postgre_config["database"])
try:
engine_mysql = create_engine(
# "mysql+mysqlconnector://root:%s@192.168.28.111:3306/waytous"
# % quote("Huituo@123")
"mysql+mysqlconnector://" + mysql_config["user"] + ":" + mysql_config["password"] + "@" + mysql_config[
"host"] + ":" + mysql_config["port"] + "/" + mysql_config["database"]
# "mysql+mysqlconnector://" + mysql_config["user"] + ":" + mysql_config["password"] + "@" + mysql_config[
# "host"] + ":" + mysql_config["port"] + "/" + mysql_config["database"]
sql_str % quote(mysql_config["password"])
)
engine_postgre = create_engine(
# "postgresql://postgres:%s@192.168.28.111:5432/shenbao_2021520"
# % quote("Huituo@123")
"postgresql://" + postgre_config["user"] + ":" + postgre_config["password"] + "@" + postgre_config[
"host"] + ":" + postgre_config["port"] + "/" + postgre_config["database"]
# "postgresql://" + postgre_config["user"] + ":" + postgre_config["password"] + "@" + postgre_config[
# "host"] + ":" + postgre_config["port"] + "/" + postgre_config["database"]
postgre_str % quote(postgre_config["password"])
)
# 创建DBsession_mysql类型:
......
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