summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/template/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/template/utils.py b/django/template/utils.py
index 3303c1ccb7..be2166810c 100644
--- a/django/template/utils.py
+++ b/django/template/utils.py
@@ -90,6 +90,10 @@ class EngineHandler(object):
"Could not find config for '{}' "
"in settings.TEMPLATES".format(alias))
+ # If importing or initializing the backend raises an exception,
+ # self._engines[alias] isn't set and this code may get executed
+ # again, so we must preserve the original params. See #24265.
+ params = params.copy()
backend = params.pop('BACKEND')
engine_cls = import_string(backend)
engine = engine_cls(params)