From 88098f5b2503f49ba55c0a8e6ba646323e110718 Mon Sep 17 00:00:00 2001 From: Sajeyks Date: Tue, 6 Oct 2026 19:55:18 +0300 Subject: [PATCH] Use Redis for the cache instead of memcached CACHE_URL (default redis://redis:6379/1) feeds the built-in RedisCache backend. Redis is already part of compose for Celery, so this drops pylibmc, python-memcached and libmemcached-dev. --- .env.docker | 1 + Dockerfile | 1 - dynamicweb/settings/base.py | 4 ++-- dynamicweb/settings/prod.py | 7 ------- requirements.archlinux.txt | 1 - requirements.debian.txt | 2 -- requirements.txt | 2 -- 7 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.env.docker b/.env.docker index c97ada00..31053058 100644 --- a/.env.docker +++ b/.env.docker @@ -14,6 +14,7 @@ POSTGRES_HOST=db CELERY_BROKER_URL=redis://redis:6379/0 CELERY_RESULT_BACKEND=redis://redis:6379/0 +CACHE_URL=redis://redis:6379/1 # Host -> urlconf. Add the VPS IP / domain here if you access it that way. UNGLEICH_SITE_CONFIGS={"ungleich.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"blog.ungleich.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"comic.ungleich.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"digitalglarus.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"datacenterlight.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"rails-hosting.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"django-hosting.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"node-hosting.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"devuanhosting.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"devuanhosting.com":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"ipv6onlyhosting.com":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"digitalezukunft.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"hack4glarus.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"xn--nglarus-n2a.ch":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"localhost:8000":{"MULTISITE_CMS_URL":"dynamicweb.urls"},"127.0.0.1:8000":{"MULTISITE_CMS_URL":"dynamicweb.urls"}} diff --git a/Dockerfile b/Dockerfile index 6d7c6c65..58ca55d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,6 @@ RUN apk add --update --no-cache \ jpeg-dev \ libxml2-dev \ libxslt-dev \ - libmemcached-dev \ zlib-dev \ libffi-dev \ && rm -rf /var/cache/apk/* diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index e2aa7708..1ee2e546 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -393,8 +393,8 @@ CMS_PERMISSION = True CACHES = { 'default': { - 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', - 'LOCATION': '127.0.0.1:11211', + 'BACKEND': 'django.core.cache.backends.redis.RedisCache', + 'LOCATION': env('CACHE_URL', 'redis://redis:6379/1'), } } diff --git a/dynamicweb/settings/prod.py b/dynamicweb/settings/prod.py index b222912f..e67467ff 100644 --- a/dynamicweb/settings/prod.py +++ b/dynamicweb/settings/prod.py @@ -7,13 +7,6 @@ DEBUG = False EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', - 'LOCATION': '127.0.0.1:11211', - } -} - # MANAGERS = ADMINS REGISTRATION_MESSAGE['message'] = REGISTRATION_MESSAGE['message'].format(host='digitalglarus.ch', diff --git a/requirements.archlinux.txt b/requirements.archlinux.txt index 15184f0d..6754ad98 100644 --- a/requirements.archlinux.txt +++ b/requirements.archlinux.txt @@ -1,2 +1 @@ base-devel -libmemcached diff --git a/requirements.debian.txt b/requirements.debian.txt index 737655a8..cf1ab0fd 100644 --- a/requirements.debian.txt +++ b/requirements.debian.txt @@ -17,8 +17,6 @@ liblcms2-dev liblzma-dev libmagickcore-dev libmagickwand-dev -libmemcached -libmemcached-dev libncurses-dev libpq-dev libreadline-dev diff --git a/requirements.txt b/requirements.txt index 087ab3d2..6e40dda3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -95,11 +95,9 @@ pyasn1==0.6.4 pycodestyle==2.15.0 pycryptodome==3.24.0 pyflakes==4.0.2 -pylibmc==1.6.3 pyotp==2.10.0 python-dateutil==2.9.0.post0 python-dotenv==1.2.4 -python-memcached==1.62 python-slugify==9.1.2 pytz==2026.5 rcssmin==1.2.2