Fix template loaders for django 1.11
authorMagnus Hagander <magnus@hagander.net>
Sun, 25 Mar 2018 14:54:59 +0000 (16:54 +0200)
committerMagnus Hagander <magnus@hagander.net>
Sun, 25 Mar 2018 14:54:59 +0000 (16:54 +0200)
Seems django 1.11 automatically enables caching template loader, which
of course breaks the ability to make any changes to the pages of a
website without restarting it. And there is no way to turn it off other
than to explicitly configure individual loders (the logic to turn it on
in non-debug configurations is hardcoded and cannot be changed).

gitadmin/gitadmin/settings.py

index 1e7d941d759bf5dd5693ef275808ca86d378a96a..911fd669be9aae4c3de65780aeba6d547ea0eea4 100644 (file)
@@ -62,13 +62,16 @@ ROOT_URLCONF = 'gitadmin.urls'
 
 TEMPLATES = [{
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
-       'APP_DIRS': True,
        'OPTIONS': {
                'context_processors': [
                        'django.template.context_processors.request',
                        'django.contrib.auth.context_processors.auth',
                        'django.contrib.messages.context_processors.messages',
                ],
+               'loaders': [
+                       'django.template.loaders.filesystem.Loader',
+                       'django.template.loaders.app_directories.Loader',
+               ],
        },
 }]