I get this error when I try to access a cached URL.
I use caches with Django for each view, and when I access the URL for the first time, it works fine, but when it should be in the cache, it returns this error. I am using FileBasedCache. This is in my settings:
CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', 'LOCATION': '/var/tmp/django_cache', 'TIMEOUT': 60, 'OPTIONS': { 'MAX_ENTRIES': 1000 } } } MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES + ( 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware' )
In urls.py something like this:
... cache_page(60*1)(MyClaseView.as_view()) ...
I blocked the access rights to the directory, everything is fine, there are .djcache files there, so it writes
By the way, this error comes from middleware (process_template_response), where I add some data to context_data.
Here is the feedback:
Traceback (most recent call last): File "/home/nexonet/.virtualenvs/esmidoctor/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 136, in get_response response = middleware_method(request, response) File "/home/nexonet/webapps/esmidoctor/esmidoctor/apps/common/middleware/template_article.py", line 12, in process_template_response response.context_data['template_admin'] = 'panel/content/base.html' AttributeError: 'TemplateResponse' object has no attribute 'context_data'
Gocht source share