templates django-error   2   1744
Solving Django Error: TemplateDoesNotExist at /app_name/

TemplateDoesNotExist at /app_name/

If you are facing above template error, there is a high possibility that at-least one of the below listed point applies to you.

1. Wrong template name:

Make sure when rendering the template, you are using right name of template. 

return render(request, 'app_name/tools.html', data)

Check if template name is actually tools or it is tool?

2. Wrong app name:

In the above render statement, confirm if the appname used is correct or not.

return render(request, 'app_name/tools.html', data)

3. Installed Apps:

Please confirm if your app is listed in installed apps in settings.py file.


4. Template Directory Structure:

Make sure your templates are places inside a directory with same name as your app's name which in itself is inside templates directory. Confused? 

So your templates directory structure should be as below.

|    |-app_name
|    |    |-tools.html

5. Where is Django looking for templates:

Confirm if Django is looking for templates in app directories. For this you need to see templates setting in settings.py file. Check if APP_DIR is set to True. If this is set to False, Django won't look for templates in app directories.

'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'context_processors': [

6. Project level templates:

If you are using something like below in your project's urls.py file

urlpatterns += [
path(r'robots.txt/', TemplateView.as_view(template_name="project_name/robots.txt", content_type='text/plain')),

It could be any file instead of robots.txt, then make sure there is templates directory in root directory of project. This template directory is outside of every app. Directory structure would be as below.

|    |-templates
|    |    |-project_name
|    |    |    |-your-template-here

These template files are project level template files.

Also add 'DIRS': [os.path.join(BASE_DIR, 'templates')],  in TEMPLATES tuple in settings.py file. BASE_DIR is defined in settings.py file at the top. If not define as below.

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

If you are still unable to resolve the error, feel free to comment or contact us or connect on facebook page.

Host your Django project for free.

templates django-error   2   1744

Related Articles:
Solving Django error 'NoReverseMatch at' URL with arguments '()' and keyword arguments '{}' not found.
Solving Django error 'NoReverseMatch at' URL with arguments '()' and keyword arguments '{}' not found, URL not found in Django, No reverse match in Django template error...
Displaying custom 404 error (page not found) page in Django 2.0
How to create custom 404 error page in Django. Handler404 example Django 2.0. Page not found error in Django 2.0. Custom Error handlers in Django 2.0...
Creating custom template tags in Django
Step by step guide to create and use custom template tags in django. how to create custom template tags in django. how to use custom template tag in django....
Designing custom 404 and 500 error pages in Django
How to create your own awesome 404 error or 500 error page in django. Step by step guide to help you design your own 404 not found error page in Django. Design your own 500 internal server error page in Django application...

2 thoughts on 'Solving Django Error: Templatedoesnotexist At /App_Name/'
Lary :
This was very helpful. Thanks a lot.

Pahang Krisdyan :
I just relize that i haven't add my new app to installed app

Leave a comment:

*All Fields are mandatory. **Email Id will not be published publicly.

Please subscribe to get the latest articles in your mailbox.

Recent Posts:

© pythoncircle.com 2018-2019
Contact Us: code108labs [at] gmail.com
Address: 3747 Smithfield Avenue, Houston, Texas