From 43e18e227ffd3c0de669266c02245099a8f083e4 Mon Sep 17 00:00:00 2001 From: raja <1647193241@qq.com> Date: Wed, 25 Sep 2024 10:59:54 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E8=93=9D=E9=B2=B8=20SaaS=20Python=20?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=A1=86=E6=9E=B6=20mysqlclient=20=E5=88=87?= =?UTF-8?q?=E6=8D=A2=20pymysql=20--story=3D119849198?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/requirements.txt | 4 +++- src/backend/settings.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/requirements.txt b/src/backend/requirements.txt index 78045b33..4458f705 100644 --- a/src/backend/requirements.txt +++ b/src/backend/requirements.txt @@ -8,6 +8,8 @@ bk_audit[opentelemetry]==1.2.2b0 bk_resource==0.4.11 +blueapps==4.14.0 + # web server gunicorn==22.0.0 @@ -24,7 +26,7 @@ drf_spectacular==0.12.0 django-environ==0.10.0 django-simpleui==2023.3.1 django-sslserver==0.22 -mysqlclient==2.1.1 +pymysql==1.1.1 # staticfiles whitenoise==5.2.0 diff --git a/src/backend/settings.py b/src/backend/settings.py index 11b321ad..cdba05f4 100644 --- a/src/backend/settings.py +++ b/src/backend/settings.py @@ -23,6 +23,7 @@ from warnings import warn import environ +import pymysql # 读取环境变量文件 # 配置优先级 环境变量 -> .env文件 -> settings.py @@ -48,6 +49,9 @@ sys.path.append(os.path.join(os.getcwd(), f"services/{DEPLOY_SERVICE}")) sys.path.append(os.path.join(os.getcwd(), "apps")) +# pysql 初始化 +pymysql.install_as_MySQLdb() + def load_settings(module_path: str, raise_exception: bool = True): try: