Fix template loaders for django 1.11
authorMagnus Hagander <magnus@hagander.net>
Sun, 25 Mar 2018 14:51:48 +0000 (16:51 +0200)
committerMagnus Hagander <magnus@hagander.net>
Sun, 25 Mar 2018 14:51:48 +0000 (16:51 +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).

pgweb/settings.py

index cb53eb50246007da8391500e89e9c8ed27a84852..faeefc1849d7ccc288cb963e3892716fb12f804a 100644 (file)
@@ -65,7 +65,6 @@ ROOT_URLCONF = 'pgweb.urls'
 TEMPLATES = [{
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['templates', ],
-       'APP_DIRS': True,
        'OPTIONS': {
                'context_processors': [
                        'django.contrib.auth.context_processors.auth',
@@ -73,6 +72,10 @@ TEMPLATES = [{
                        'django.template.context_processors.media',
                        'pgweb.util.contexts.PGWebContextProcessor',
                ],
+               'loaders': [
+                       'django.template.loaders.filesystem.Loader',
+                       'django.template.loaders.app_directories.Loader',
+               ],
        },
 }]