Skip to content

Commit

Permalink
Development: disable cached Loader on DEBUG=True (#10640)
Browse files Browse the repository at this point in the history
On Django 4.1 the cached Loader is enabled on `DEBUG=True`.
This commit reverts this behavior because it makes harder to work on the new
templates.

Closes readthedocs/readthedocs-corporate#1635
  • Loading branch information
humitos authored Aug 16, 2023
1 parent 4ddf876 commit d2ac8bb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion readthedocs/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,22 @@ def TEMPLATES(self):
os.path.dirname(readthedocsext.theme.__file__),
'templates',
))

# Disable ``cached.Loader`` on development
# https://docs.djangoproject.com/en/4.2/ref/templates/api/#django.template.loaders.cached.Loader
default_loaders = [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
]
cached_loaders = [("django.template.loaders.cached.Loader", default_loaders)]

return [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': dirs,
'APP_DIRS': True,
'OPTIONS': {
'debug': self.DEBUG,
'loaders': default_loaders if self.DEBUG else cached_loaders,
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
Expand Down

0 comments on commit d2ac8bb

Please sign in to comment.