8
With your current directory structure, you can’t – it’s done this way to allow you to override templates by apps later on in your INSTALLED_APPS
setting. The convention is to use a directory structure more like:
app1/templates/app1/base.html
app2/templates/app2/base.html
And then use app1/base.html
or app2/base.html
to refer to the one you want.
Edit
To be more clear on what I mean: your project structure could look like this:
mysite
- templates
- base.html
- manage.py (etc...)
- app
- models.py (etc...)
- templates
- app
- base.html
Then you can use base.html
to get the first one and app/base.html
to get the other – and the relevant app templates are all packaged inside the app they refer to, but are namespaced.
3
It’s good practice to create extra level in file structure. So put templates in templates/<app_name>/
folder. Then you can reference them with templates/app1/base.html
and templates/app2/base.html
.