How to Solve NameError: name 'TemplateDoesNotExist' is not defined -- django

Solution: Import the 'TemplateDoesNotExist' module

# Add the following line to the top of your code
from django.template import TemplateDoesNotExist

 

For more information:
django TemplateDoesNotExist