From 191d37dd56567b0c25f31779767eecede86e3ae4 Mon Sep 17 00:00:00 2001 From: halo Date: Wed, 13 Jul 2022 09:32:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81session=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E6=96=B9=E5=BC=8F=E5=8F=AF=E9=85=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E5=8F=AF=E9=80=89cache=E6=88=96db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jumpserver/conf.py | 1 + apps/jumpserver/settings/base.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index c3a0a0210..551076192 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -383,6 +383,7 @@ class Config(dict): 'SESSION_COOKIE_SECURE': False, 'CSRF_COOKIE_SECURE': False, 'REFERER_CHECK_ENABLED': False, + 'SESSION_ENGINE': 'cache', 'SESSION_SAVE_EVERY_REQUEST': True, 'SESSION_EXPIRE_AT_BROWSER_CLOSE_FORCE': False, 'SERVER_REPLAY_STORAGE': {}, diff --git a/apps/jumpserver/settings/base.py b/apps/jumpserver/settings/base.py index 9b4cfb668..519623ac9 100644 --- a/apps/jumpserver/settings/base.py +++ b/apps/jumpserver/settings/base.py @@ -3,6 +3,7 @@ import platform if platform.system() == 'Darwin' and platform.machine() == 'arm64': import pymysql + pymysql.version_info = (1, 4, 2, "final", 0) pymysql.install_as_MySQLdb() @@ -109,8 +110,6 @@ MIDDLEWARE = [ 'simple_history.middleware.HistoryRequestMiddleware', ] - - ROOT_URLCONF = 'jumpserver.urls' TEMPLATES = [ @@ -161,7 +160,7 @@ SESSION_EXPIRE_AT_BROWSER_CLOSE = True # 自定义的配置,SESSION_EXPIRE_AT_BROWSER_CLOSE 始终为 True, 下面这个来控制是否强制关闭后过期 cookie SESSION_EXPIRE_AT_BROWSER_CLOSE_FORCE = CONFIG.SESSION_EXPIRE_AT_BROWSER_CLOSE_FORCE SESSION_SAVE_EVERY_REQUEST = CONFIG.SESSION_SAVE_EVERY_REQUEST -SESSION_ENGINE = "django.contrib.sessions.backends.cache" +SESSION_ENGINE = "django.contrib.sessions.backends.{}".format(CONFIG.SESSION_ENGINE) MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage' # Database