From d0abc616bfbf994eea55d098b8b4facdd5cc6ba7 Mon Sep 17 00:00:00 2001 From: George Lacey Date: Tue, 18 May 2021 20:40:44 +0100 Subject: [PATCH] Switch from memcached to redis --- borgweb/borgweb/production.py | 11 ++++++++--- borgweb/setup.sh | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/borgweb/borgweb/production.py b/borgweb/borgweb/production.py index e2568f4..d92e689 100644 --- a/borgweb/borgweb/production.py +++ b/borgweb/borgweb/production.py @@ -120,12 +120,17 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' # cache CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache', - 'LOCATION': '127.0.0.1:11211', + "default": { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": "redis://127.0.0.1:6379/1", + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient" + }, + "KEY_PREFIX": "borgweb" } } + # security SESSION_COOKIE_SECURE=True SECURE_SSL_REDIRECT=True diff --git a/borgweb/setup.sh b/borgweb/setup.sh index 1135a92..5627b49 100644 --- a/borgweb/setup.sh +++ b/borgweb/setup.sh @@ -35,7 +35,7 @@ print_action "Installing pip packages, this may take a while..." # install required pip packages yes | python -m pip install --upgrade wheel -yes | python -m pip install django gunicorn django-libsass django-compressor django-axes pymemcache +yes | python -m pip install django gunicorn django-libsass django-compressor django-axes django-redis print_action "Setting up static files and database"