summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhandingkang <[email protected]>2024-05-27 16:58:24 +0800
committerhandingkang <[email protected]>2024-05-27 16:58:24 +0800
commitbca9c56241ac8c489e5e840ba6e14438683040f7 (patch)
tree352ecab2bc0222fa797703a4a86d7c8a135db539
parentc9690da79c589c1e9c533c04f974cc5fcb489486 (diff)
1. 数据库连接问题修复尝试
-rw-r--r--server/apps/util.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/server/apps/util.py b/server/apps/util.py
index 2205018..b90a408 100644
--- a/server/apps/util.py
+++ b/server/apps/util.py
@@ -161,9 +161,11 @@ class DataHandler:
pass
# 完成初始化,重新以标明数据库的方式连接
try:
+ self.cursor.close()
self.conn.close()
self.conn = pymysql.connect(cursorclass=DictCursor, host=MYSQL_HOST, user='root',
password=MYSQL_PAWD, port=MYSQL_PORT, database=MYSQL_DATADB)
+ self.cursor = self.conn.cursor()
except Exception as e:
error(str(e))
# 数据库连接失败,停止后续操作