I am trying to cache a class based view like so
urls.py
from django.views.decorators.cache import cache_page
from django.conf.urls import url
urlpatterns = [
url(r'^/awesome-url$', cache_page(60 * 60)(TemplateView.as_view(template_name="awesome.html")), name="awesome"),
]
settings.py
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'unique-snowflake'
}
}
My hope was to have my views cached and I wanted to verify that this was happening by inspecting it with:
from django.core.cache.backends import locmem
print locmem._caches
>{}
Source: Contents of locmem cache in django?
Sadly the backend is empty. So I am doubtful that the view is being cached, can anyone help?