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 Template Inheritance

Why layout.html in site templates folder rather than app templates folder?

I'm not getting why Kenneth has us put layout.html and base.html into learning_site/templates/ rather than putting them into learning_site/courses/templates/?

I would think these two files should go into whichever app they are specifically designed for, not the broader site templates which would be applied to any and all apps?

So, if you make more than one app, aren't these necessarily going to apply to those apps as well as to the Courses app?

1 Answer

Jacinto Jacinto
seal-mask
.a{fill-rule:evenodd;}techdegree
Jacinto Jacinto
Python Web Development Techdegree Student 7,869 Points

It's because this layout template is intended to be used by all the app views and primary site views. It will not just be elusively used by courses.

In the example here it's used by the view within learning_site. It would be quite awkward to extend a template view from the courses app to render a view within learning site.