Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Django Basics Django Templates Templates

Brandon Galde
Brandon Galde
12,741 Points

Can't find templates directory

I am having trouble finding the templates directory after running my code. I get the following error on my page:

TemplateDoesNotExist at /
Request Method: GET
Request URL:
Django Version: 1.7.11
Exception Type: TemplateDoesNotExist
Exception Value:    
Exception Location: /usr/lib/python3/dist-packages/django/template/loader.py in find_template, line 136
Python Executable:  /usr/bin/python3
Python Version: 3.4.2
Python Path:    
Server time:    Sat, 22 Apr 2017 14:27:04 -0400
Template-loader postmortem

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/usr/lib/python3/dist-packages/django/contrib/admin/templates/home.html (File does not exist)
/usr/lib/python3/dist-packages/django/contrib/auth/templates/home.html (File does not exist)
/home/soulji/django-project/learning_site/courses/templates/home.html (File does not exist)

My paths are correct, however I am wondering if this error is due to my django version. The TEMPLATES section did not already exist in the settings.py file, so I added it, and attempted to make a few changes to try to solve this issue (such as removing the OPTIONS field within TEMPLATES). It appears that it just does not look to find the templates directory in the learning_sites directory at all.

All my code is the same as Keven's, with the exception of portions in the settings.py file (which I had to add the missing section mentioned above). If I need to post more of the error I can do that. Any help will be welcome, thanks.

Brandon Galde
Brandon Galde
12,741 Points

It was my django verson. I upgraded from 1.7.11 to 2.0 (what I found on git). I'm sure this'll break some other features demonstrated in the videos, so we'll see how that works out.