Answer the question
In order to leave comments, you need to log in
Why doesn't file caching work correctly in Django?
I think many have come across, but perhaps not everyone noticed. I have this problem already on the third project.
Generally. I set up file caching in a very trite way, only in settings:
MIDDLEWARE = [
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.gzip.GZipMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
]
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': os.path.join(BASE_DIR, 'cache'),
'TIMEOUT': 300,
'OPTIONS': {
'MAX_ENTRIES': 1000
}
}
}
Answer the question
In order to leave comments, you need to log in
Depending on what you cached.
I had such tricks when on site cache was enabled.
I sawed it out and made it in pieces in the template and in the views
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question