From 2de655a8dfea3623d2102f8cc9a9fc6857bc8a5a Mon Sep 17 00:00:00 2001 From: willipink Date: Sat, 19 Dec 2020 10:33:13 +0000 Subject: [PATCH] #13 tweak caching settings --- coinmanager/coinmanager/production_settings.py | 3 ++- coinmanager/coinmanager/settings.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/coinmanager/coinmanager/production_settings.py b/coinmanager/coinmanager/production_settings.py index 2027724..375e179 100644 --- a/coinmanager/coinmanager/production_settings.py +++ b/coinmanager/coinmanager/production_settings.py @@ -47,6 +47,7 @@ MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', + 'django.middleware.http.ConditionalGetMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', @@ -142,4 +143,4 @@ CACHES = { # caching CACHE_MIDDLEWARE_ALIAS = 'default' -CACHE_MIDDLEWARE_SECONDS = 600 +CACHE_MIDDLEWARE_SECONDS = 60*60*24*7 diff --git a/coinmanager/coinmanager/settings.py b/coinmanager/coinmanager/settings.py index 2300e81..2b5ddae 100644 --- a/coinmanager/coinmanager/settings.py +++ b/coinmanager/coinmanager/settings.py @@ -44,7 +44,9 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', + 'django.middleware.cache.FetchFromCacheMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', @@ -126,3 +128,7 @@ MAINTENANCE_MODE_READ_ONLY = False # do not redirect after login LOGIN_REDIRECT_URL = './' + +# caching +CACHE_MIDDLEWARE_ALIAS = willipink_coinc +CACHE_MIDDLEWARE_SECONDS = 600