Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> In some ways, Django tries to be flexible, but it's clumsy. For example, you can have your templates in your app directories. So, you have /path/to/project/posts/templates and /path/to/project/people/templates. However, you can't just put your templates in there because Django doesn't namespace them. Like, if I do {% extends "people/base.html" %} it will look in both those template directories for a people folder. It won't be like, "oh, I should look in /path/to/project/people/templates/base.html". I have to put the template in /path/to/project/people/templates/people/base.html. That's clumsy.

That one I completely disagree with, especially considering the idea of reusable applications.

While the repetition of 'people' does feel redundant at first glance, it means a second application can have its own `people/base.html` template which will be used instead of the one originally provided by `people`, and without needing any magical manipulation of paths/namespaces in the template loader. The path within the templates folder is completely independent from the path outside of it. And I think that's a fine behavior for the app_directories and the eggs loaders.

Furthermore, note that you could write your own template loader based on these which will do the namespace munging for you. How is that "Django tries to be flexible, but it's clumsy"?



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: