From a8537edad50639286e2fef814336deb46fb6a270 Mon Sep 17 00:00:00 2001 From: jiayuan929 <252461528@qq.com> Date: Mon, 23 Sep 2024 17:11:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=20pymysql=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=20(#1617)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apiserver/paasng/paasng/settings/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apiserver/paasng/paasng/settings/__init__.py b/apiserver/paasng/paasng/settings/__init__.py index 92dceae345..81faefbf2f 100644 --- a/apiserver/paasng/paasng/settings/__init__.py +++ b/apiserver/paasng/paasng/settings/__init__.py @@ -47,6 +47,7 @@ from pathlib import Path from typing import Any, Dict, List, Optional +import pymysql from bkpaas_auth.core.constants import ProviderType from django.contrib import messages from django.utils.encoding import force_bytes, force_str @@ -84,6 +85,10 @@ _notset = object() +pymysql.install_as_MySQLdb() +# Patch version info to forcely pass Django client check +setattr(pymysql, "version_info", (1, 4, 2, "final", 0)) + # 蓝鲸数据库内容加密私钥 # 使用 `from cryptography.fernet import Fernet; Fernet.generate_key()` 生成随机秘钥 # 详情查看:https://cryptography.io/en/latest/fernet/