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

hamnadmin/hamnadmin/settings.py

index 6e7ac5c88038b14c758e3bcf928c1cd28ee77968..05cd52a6c04dee8d15d9975df23d08f3a1c7b1b9 100644 (file)
@@ -43,13 +43,16 @@ ROOT_URLCONF = 'hamnadmin.urls'
 TEMPLATES = [{
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(os.path.dirname(__file__), '../../template')],
-       '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',
+               ],
        },
 }]