title: Following error raised: TemplateDoesNotExist(template_name, chain=chain) django.template.exceptions.TemplateDoesNotExist
body: <p>I am trying to handle errors in my Django project and I keep receiving the following message:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/wsgiref/handlers.py&quot;, line 137, in run
      self.result = application(self.environ, self.start_response)
    File &quot;/Users/Tom/.local/share/virtualenvs/squeasy_-djXBooHN/lib/python3.9/site-packages/django/core/handlers/wsgi.py&quot;, line 132, in __call__
      response = self.get_response(request)
    File &quot;/Users/Tom/.local/share/virtualenvs/squeasy_-djXBooHN/lib/python3.9/site-packages/django/core/handlers/base.py&quot;, line 140, in get_response
      response = self._middleware_chain(request)
    File &quot;/Users/Tom/.local/share/virtualenvs/squeasy_-djXBooHN/lib/python3.9/site-packages/django/core/handlers/exception.py&quot;, line 57, in inner
      response = response_for_exception(request, exc)
    File &quot;/Users/Tom/.local/share/virtualenvs/squeasy_-djXBooHN/lib/python3.9/site-packages/django/core/handlers/exception.py&quot;, line 139, in response_for_exception
      response = handle_uncaught_exception(
    File &quot;/Users/Tom/.local/share/virtualenvs/squeasy_-djXBooHN/lib/python3.9/site-packages/django/core/handlers/exception.py&quot;, line 184, in handle_uncaught_exception
      return callback(request)
    File &quot;/Users/Tom/Desktop/squeasy /tasks/views.py&quot;, line 31, in handler500
      response = render(request, template_name)
    File &quot;/Users/Tom/.local/share/virtualenvs/squeasy_-djXBooHN/lib/python3.9/site-packages/django/shortcuts.py&quot;, line 24, in render
      content = loader.render_to_string(template_name, context, request, using=using)
    File &quot;/Users/Tom/.local/share/virtualenvs/squeasy_-djXBooHN/lib/python3.9/site-packages/django/template/loader.py&quot;, line 61, in render_to_string
      template = get_template(template_name, using=using)
    File &quot;/Users/Tom/.local/share/virtualenvs/squeasy_-djXBooHN/lib/python3.9/site-packages/django/template/loader.py&quot;, line 19, in get_template
      raise TemplateDoesNotExist(template_name, chain=chain)
  django.template.exceptions.TemplateDoesNotExist: 500.html
  
  </code></pre>
  <p>For my settings:</p>
  <pre><code>TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': [BASE_DIR /'squeasy/tasks/templates/tasks'],
          '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>
  <p>I have also tried:</p>
  <pre><code>'DIRS': [],
          'APP_DIRS': True,
  </code></pre>
  <p>and</p>
  <pre><code>'DIRS': [os.path.join(BASE_DIR, 'templates')],
  </code></pre>
  <p>and</p>
  <pre><code>'DIRS': [BASE_DIR/'templates'],
  </code></pre>
  <p>I have no other errors when running templates normally, it is only when I force an error.</p>
  <p>I have the following <strong>views.py</strong> to handle 400, 403 and 404 error requests:</p>
  <pre><code>def handler400(request, exception, template_name = &quot;400.html&quot;):
      response = render(request, template_name)
      response.status_code = 400
      return response
  
  def handler403(request, exception, template_name = &quot;403.html&quot;):
      response = render(request, template_name)
      response.status_code = 403
      return response
  
  def handler404(request, exception, template_name=&quot;404.html&quot;):
      response = render(request, template_name)
      response.status_code = 404
      return response
  
  def handler500(request, template_name=&quot;500.html&quot;):
      response = render(request, template_name)
      response.status_code = 500
      return response
  </code></pre>
  <p>In my Project's <strong>urls.py</strong> file I have:</p>
  <pre><code>    handler400 = 'tasks.views.handler400'
      handler403 = 'tasks.views.handler403'
      handler404 = 'tasks.views.handler404'
      handler500 = 'tasks.views.handler500'
  </code></pre>
  <p>The app that the views are in is named tasks.</p>
  <p><code>DEBUG = False</code> is in my settings.py file.</p>