TemplateDoesNotExist broken_template.html

Raised by:

django/template/loader.py (line 53)

Traceback (most recent call last):
  File "python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "python3.6/site-packages/django/core/handlers/base.py", line 217, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "python3.6/site-packages/django/core/handlers/base.py", line 215, in _get_response
    response = response.render()
  File "python3.6/site-packages/django/template/response.py", line 107, in render
    self.content = self.rendered_content
  File "python3.6/site-packages/django/template/response.py", line 82, in rendered_content
    template = self.resolve_template(self.template_name)
  File "python3.6/site-packages/django/template/response.py", line 64, in resolve_template
    return select_template(template, using=self.using)
  File "python3.6/site-packages/django/template/loader.py", line 53, in select_template
    raise TemplateDoesNotExist(', '.join(template_name_list), chain=chain)
django.template.exceptions.TemplateDoesNotExist: broken_template.html

How to reproduce

Try to use a template that does not exist in your project.

For example, add the following to your urls.py, and try to access /error/:

from django.views.generic import TemplateView

urlpatterns = [
    url(r'^error$', TemplateView.as_view(template_name='blablabla.html'), name='index'),

How to fix

  • Verify if there are any spell errors in your template name.
  • Verify if the path to your template is correct.
  • Verify if your template is correctly placed in a templates folder of one of your apps.
  • Verify if your template folder is correctly listed in the templates DIRS.
  • Verify if the app template where template belongs is on INSTALLED_APPS