From a19a837e82eb9bed398af236ee2a8527f54b7af2 Mon Sep 17 00:00:00 2001 From: Oliver Falk Date: Mon, 18 Feb 2019 16:40:44 +0100 Subject: [PATCH] Enable memcache caching --- config.py | 13 +++++++++++++ requirements.txt | 1 + 2 files changed, 14 insertions(+) diff --git a/config.py b/config.py index 5157978..a7593a6 100644 --- a/config.py +++ b/config.py @@ -28,10 +28,14 @@ INSTALLED_APPS.extend([ MIDDLEWARE.extend([ 'django.middleware.locale.LocaleMiddleware', + 'django.middleware.cache.FetchFromCacheMiddleware', ]) MIDDLEWARE.insert( 0, 'ivatar.middleware.MultipleProxyMiddleware', ) +MIDDLEWARE.insert( + 1, 'django.middleware.cache.UpdateCacheMiddleware', +) AUTHENTICATION_BACKENDS = ( # Enable this to allow LDAP authentication. @@ -175,3 +179,12 @@ MESSAGE_TAGS = { message_constants.WARNING: 'warning', message_constants.ERROR: 'danger', } + +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': [ + '127.0.0.1:11211', + ], + } +} diff --git a/requirements.txt b/requirements.txt index 8483f73..fb00e31 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,3 +35,4 @@ notsetuptools git+https://github.com/ofalk/monsterid.git git+https://github.com/azaghal/pydenticon.git git+https://github.com/ofalk/Robohash.git@devel +python-memcached