From 71198542333ca681b369cffa927bc16d00ba9275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BC=BA?= <1206709430@qq.com> Date: Sun, 10 Apr 2022 00:06:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96plugins=E6=8F=92=E4=BB=B6=E8=B7=AF=E5=BE=84=E5=88=B0?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/application/settings.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/application/settings.py b/backend/application/settings.py index f668410..8c60b21 100644 --- a/backend/application/settings.py +++ b/backend/application/settings.py @@ -28,7 +28,10 @@ from conf.env import * # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure--z8%exyzt7e_%i@1+#1mm=%lb5=^fx_57=1@a+_y7bg5-w%)sm' -sys.path.insert(0, os.path.join(BASE_DIR, 'plugins')) +# 初始化plugins插件路径到环境变量中 +PLUGINS_PATH = os.path.join(BASE_DIR, 'plugins') +[sys.path.insert(0, os.path.join(PLUGINS_PATH, ele)) for ele in os.listdir(PLUGINS_PATH) if + os.path.isdir(os.path.join(PLUGINS_PATH, ele)) and not ele.startswith('__')] # SECURITY WARNING: don't run with debug turned on in production! DEBUG = locals().get('DEBUG', True)