﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24265	jinja2 template backend results in KeyError	Rob Hudson	Aymeric Augustin	"I created a new django 1.8a1 project. I made a couple settings changes, one of which was changing the single TEMPLATES config's 'BACKEND' to the jinja2 backend. I have no templates yet or URLs other than the default and attempted to visit the ""It worked!"" page but got a 500 instead.

Traceback follows:
{{{
Traceback (most recent call last):
  File ""/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py"", line 85, in run
    self.result = application(self.environ, self.start_response)
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py"", line 64, in __call__
    return self.application(environ, start_response)
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/core/handlers/wsgi.py"", line 191, in __call__
    response = self.get_response(request)
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/core/handlers/base.py"", line 217, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/core/handlers/base.py"", line 260, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/views/debug.py"", line 100, in technical_500_response
    html = reporter.get_traceback_html()
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/views/debug.py"", line 382, in get_traceback_html
    c = Context(self.get_traceback_data(), use_l10n=False)
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/views/debug.py"", line 284, in get_traceback_data
    default_template_engine = Engine.get_default()
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/utils/lru_cache.py"", line 125, in wrapper
    result = user_function(*args, **kwds)
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/template/engine.py"", line 75, in get_default
    django_engines = [engine for engine in engines.all()
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/template/utils.py"", line 104, in all
    return [self[alias] for alias in self]
  File ""/Users/rob/.virtualenvs/tastytaps/lib/python2.7/site-packages/django/template/utils.py"", line 93, in __getitem__
    backend = params.pop('BACKEND')
KeyError: 'BACKEND'
}}}

I attempted to debug this -- it appears that the template settings are getting processed twice. The first time it works. The 2nd time it doesn't since the 'BACKEND' key was popped off the dict. Changing `pop` to `get` in django/template/utils.py:L93 fixed the issue for me.
"	Bug	closed	Template system	1.8alpha1	Normal	fixed	multiple-template-engines 1.8-beta		Accepted	1	0	0	0	0	0
