Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics Django Templates Templates

Gabriel Umali
PLUS
Gabriel Umali
Courses Plus Student 3,043 Points

TemplateDoesNotExist at/

Greetings Everyone! Need help ! I got the learning_site/courses/ to run but I cannot run the home.html. It says "TemplateDoesNotExist at/"

\learning_site\courses\templates\home.html (Source does not exist) Did I do something wrong?

Thank you

Jaan Talvet
Jaan Talvet
4,950 Points

it's easy to miss, but the instructor put the new templates folder under the top /learning_site folder.

1 Answer

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,716 Points

File this under the "hear me now and believe me later" category since it seems a little redundant to have another "courses" folder under the "templates" folder, but is necessary to maintain consistent "namespacing" with multiple apps in a project. In the future, you will totally appreciate Django's namespace model as it will protect you from having "name collisions".

The template just cannot be found by Django's render() where you have it currently located.

Place "home.html" so that its path is-- "\learning_site\courses\templates\courses\home.html"

...and then refer to it with "courses/home.html"

def home_view(request):
    return render(request, "courses/home.html")

Django has a bit of a learning curve, but well worth the effort!