title: Unable to set up Jinja2 with Django
body: <p>I've installed Django 1.9.7, and I have Pythons 3.4.3 and 2.7.10 on Ubuntu.</p>
  
  <p>These are the steps I've followed:</p>
  
  <ol>
  <li>Made a new project with <code>django-admin startproject testproject</code></li>
  <li><code>cd testproject/testproject</code></li>
  <li>Made an app within the project with <code>django-admin startapp testapp</code></li>
  <li>Made a directory for templates in that app with <code>mkdir testapp/templates</code> and added a very basic <code>index.html</code> template in there</li>
  <li><p>Edited <code>settings.py</code> to change the template backend to <code>django.template.backends.jinja2.Jinja2</code>, by editing line 57 of the default settings file, and to add <code>testproject.testapp</code> to <code>INSTALLED_APPS</code>; the <code>TEMPLATES</code> section is therefore like this:</p>
  
  <pre><code>TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.jinja2.Jinja2',
          'DIRS': [],
          'APP_DIRS': True,
          'OPTIONS': {
              'context_processors': [
                  'django.template.context_processors.debug',
                  'django.template.context_processors.request',
                  'django.contrib.auth.context_processors.auth',
                  'django.contrib.messages.context_processors.messages',
              ],
          },
      },
  ]
  </code></pre></li>
  <li><p>Edited <code>urls.py</code>, adding <code>from testproject.testapp import views</code> and a URL pattern <code>url(r'^$', views.index),</code></p></li>
  <li><p>Edited <code>testapp/views.py</code> adding</p>
  
  <pre><code>def index(request):
      return render(request, 'index.html')
  </code></pre></li>
  <li><p><code>cd ..</code></p></li>
  <li>Ran the server with <code>python3 manage.py runserver</code>, or <code>python manage.py runserver</code> -- very similar effect</li>
  <li>Take a browser to <code>http://localhost:3000</code></li>
  </ol>
  
  <p>I get an error. On the command line I get this:</p>
  
  <pre><code>Internal Server Error: /
  Traceback (most recent call last):
    File "/usr/local/lib/python3.4/dist-packages/django/template/utils.py", line 86, in __getitem__
      return self._engines[alias]
  KeyError: 'jinja2'
  </code></pre>
  
  <p>Followed by another exception caused "during handling of the above exception", which matches the exception I see in the browser:</p>
  
  <pre><code>Environment:
  
  
  Request Method: GET
  Request URL: http://localhost:3000/
  
  Django Version: 1.9.7
  Python Version: 3.4.3
  Installed Applications:
  ['django.contrib.staticfiles', 'testproject.testapp', 'webpack_loader']
  Installed Middleware:
  ['django.middleware.security.SecurityMiddleware',
   'django.middleware.common.CommonMiddleware',
   'django.middleware.clickjacking.XFrameOptionsMiddleware']
  
  
  
  Traceback:
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/utils.py" in __getitem__
    86.             return self._engines[alias]
  
  During handling of the above exception ('jinja2'), another exception occurred:
  
  File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py" in get_response
    174.                     response = self.process_exception_by_middleware(e, request)
  
  File "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py" in get_response
    172.                     response = response.render()
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/response.py" in render
    160.             self.content = self.rendered_content
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/response.py" in rendered_content
    135.         template = self._resolve_template(self.template_name)
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/response.py" in _resolve_template
    90.         new_template = self.resolve_template(template)
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/response.py" in resolve_template
    80.             return select_template(template, using=self.using)
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/loader.py" in select_template
    55.     engines = _engine_list(using)
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/loader.py" in _engine_list
    143.     return engines.all() if using is None else [engines[using]]
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/utils.py" in all
    110.         return [self[alias] for alias in self]
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/utils.py" in &lt;listcomp&gt;
    110.         return [self[alias] for alias in self]
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/utils.py" in __getitem__
    101.             engine = engine_cls(params)
  
  File "/usr/local/lib/python3.4/dist-packages/django/template/backends/jinja2.py" in __init__
    35.         self.env = environment_cls(**options)
  
  Exception Type: TypeError at /
  Exception Value: __init__() got an unexpected keyword argument 'context_processors'
  </code></pre>
  
  <p>I get very similar traces with Python 2.</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/35566182/django-templates-and-apps-not-loading">this question</a> which has a similar error message (<code>KeyError: 'jinja2'</code>) but seems to be a separate problem, and <a href="https://code.djangoproject.com/ticket/24265" rel="nofollow noreferrer">this bug report</a> which has the same error again whose solution is to install jinja2, but jinja2 is definitely installed. At least, I can run <code>python</code> or <code>python3</code> and then <code>import jinja2</code>. <code>pip</code> says jinja2 is up to date.</p>
  
  <p>I must be missing something crucial -- any ideas?</p>