Closed DatCGI2net closed 2 years ago
I think the following patch solves the problem:
diff --git a/mezzanine/core/middleware.py b/mezzanine/core/middleware.py
index 224488ec..7efe1819 100755
--- a/mezzanine/core/middleware.py
+++ b/mezzanine/core/middleware.py
@@ -241,7 +241,7 @@ class FetchFromCacheMiddleware(MiddlewareMixin):
# won't receieve one on their first request, with cache
# middleware running.
if csrf_middleware_installed():
- csrf_mw = CsrfViewMiddleware()
+ csrf_mw = CsrfViewMiddleware(self.get_response)
csrf_mw.process_view(request, lambda x: None, None, None)
get_token(request)
if response is None:
This makes the request fly fine through the middleware and the cached response is used. However, there might be a better or more proper solution to this. I'm not that familiar with Django's middlewares.
:tada: This issue has been resolved in version 5.1.2 :tada:
The release is available on:
v5.1.2
Your semantic-release bot :package::rocket:
Is there an existing issue for this?
Current Behavior
When setting cache for django, the issue is arosen.
Expected Behavior
It should be working when settings cache for django.
Steps To Reproduce
CACHES = { "default": { "BACKEND": "django.core.cache.backends.redis.RedisCache", "LOCATION": "redis://127.0.0.1:6379", } }
Environment
Anything else?
No response