Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
integrated-scheduling-v3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
虢奥
integrated-scheduling-v3
Commits
f9f2cf59
Commit
f9f2cf59
authored
Nov 11, 2021
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复数据库链接BUG
parent
d9c18bb7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
settings.py
settings.py
+16
-4
No files found.
settings.py
View file @
f9f2cf59
...
...
@@ -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类型:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment