From 7d20dcfffb8323163fa5ec745aa954f31f396f9a Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Tue, 9 Jun 2026 09:50:47 -0300 Subject: [PATCH 1/2] [chores] Separated session redis bucket from cache bucket --- tests/openwisp2/settings.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/tests/openwisp2/settings.py b/tests/openwisp2/settings.py index b6292034..164d0f31 100644 --- a/tests/openwisp2/settings.py +++ b/tests/openwisp2/settings.py @@ -95,11 +95,27 @@ ASGI_APPLICATION = "openwisp2.asgi.application" +CACHES = { + "default": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://localhost/0", + "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"}, + }, + "sessions": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://localhost/1", + "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"}, + }, +} + +SESSION_ENGINE = "django.contrib.sessions.backends.cache" +SESSION_CACHE_ALIAS = "sessions" + # Needed to test UI updates via websockets CHANNEL_LAYERS = { "default": { "BACKEND": "channels_redis.core.RedisChannelLayer", - "CONFIG": {"hosts": ["redis://localhost/9"]}, + "CONFIG": {"hosts": ["redis://localhost/3"]}, } } FORM_RENDERER = "django.forms.renderers.TemplatesSetting" @@ -223,11 +239,18 @@ CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": "redis://localhost/9", + "LOCATION": "redis://localhost/0", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", }, - } + }, + "sessions": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://localhost/1", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient", + }, + }, } if os.environ.get("SAMPLE_APP", False): From 4bacb85d901ed9adf8f642f6d3a0cc2a0d0196d1 Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Tue, 9 Jun 2026 10:50:55 -0300 Subject: [PATCH 2/2] [chores] Separated session redis bucket from cache bucket --- tests/openwisp2/settings.py | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/tests/openwisp2/settings.py b/tests/openwisp2/settings.py index 164d0f31..af6b30b0 100644 --- a/tests/openwisp2/settings.py +++ b/tests/openwisp2/settings.py @@ -95,22 +95,6 @@ ASGI_APPLICATION = "openwisp2.asgi.application" -CACHES = { - "default": { - "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": "redis://localhost/0", - "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"}, - }, - "sessions": { - "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": "redis://localhost/1", - "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"}, - }, -} - -SESSION_ENGINE = "django.contrib.sessions.backends.cache" -SESSION_CACHE_ALIAS = "sessions" - # Needed to test UI updates via websockets CHANNEL_LAYERS = { "default": { @@ -243,14 +227,7 @@ "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", }, - }, - "sessions": { - "BACKEND": "django_redis.cache.RedisCache", - "LOCATION": "redis://localhost/1", - "OPTIONS": { - "CLIENT_CLASS": "django_redis.client.DefaultClient", - }, - }, + } } if os.environ.get("SAMPLE_APP", False):