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

Simon Amz
Simon Amz
4,606 Points

Which directory to put templates in?

Hi there, I have a small question about creating tempaltes.

Indeed, for authentication, we often need to override some templates to customize them.

I don't understand why, for signup.html template, we had to create it in msg/accounts/templates/accounts/

whereas, for 'password_reset', 'password_reset_done', and 'password_reset_confirm', they have been created in msg/templates/registration directory

Which is the rule to know where we have to override it.

Besides, this is the same logic for urls.

Thanks for your help

2 Answers

nicole lumpkin
PLUS
nicole lumpkin
Courses Plus Student 5,328 Points

Hi Simon Amz , I'm not sure if you're using Django or Flask, and you're definitely ahead of me in your studies, but one thing comes to mind. In Django, templates at the application level are structured like project_name/app_name/templates/app_name which looks similar to what you posted (msg/accounts/templates/accounts/). Whereas templates at the project level are structured like project_name/templates/ which looks similar to (msg/templates/registration directory). Not sure if this is helpful :) good luck!

Simon Amz
Simon Amz
4,606 Points

It's exactly this. And the project is on Django. So the question is how do we know if we have to put templates at project level or app level?

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

I don't understand why, for signup.html template, we had to create it in msg/accounts/templates/accounts/ - this is not required - you could save it in the registration folder if you prefer to save it there instead