From b765b03a209de98eed42c3c57439a545796efd6e Mon Sep 17 00:00:00 2001 From: Jean-Marie Favreau Date: Sun, 18 Aug 2024 14:55:39 +0200 Subject: [PATCH] Ajout cache --- src/agenda_culturel/settings/base.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/agenda_culturel/settings/base.py b/src/agenda_culturel/settings/base.py index c0e232d..8661ab5 100644 --- a/src/agenda_culturel/settings/base.py +++ b/src/agenda_culturel/settings/base.py @@ -62,6 +62,9 @@ MIDDLEWARE = [ "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", + "django.middleware.cache.UpdateCacheMiddleware", + "django.middleware.common.CommonMiddleware", + "django.middleware.cache.FetchFromCacheMiddleware", ] CKEDITOR_CONFIGS = { @@ -187,6 +190,17 @@ CELERY_RESULT_BACKEND = REDIS_URL # SCSS COMPRESS_PRECOMPILERS = (("text/x-scss", "django_libsass.SassCompiler"),) +# cache + +CACHES = { + "default": { + "BACKEND": "django.core.cache.backends.redis.RedisCache", + "LOCATION": REDIS_URL, + "KEY_PREFIX": "agenda", + "TIMEOUT": 60 * 15, + } +} + # EMAIL settings