Possible Duplicate:
Django view – load template from calling app's dir first
I have Django project with a number of applications. Actually file structure is following:
myproj/
default/
templates/
index.html (1)
app1/
templates/
index.html (2)
app2/
templates/
index.html (3)
I expected that active application’s template directory has highest priority when template resolving. But actually I got the first template accordingly to INSTALLED_APPS order!
If I changing order of installed apps – template is changed correspondingly.
Question: is there way to get template from current application first? Of uniqueness of template name/explicit directory specification is the only way to achieve it?
The usual solution is to put templates in another subdirectory, named after your app, such as:
This is done by the shipped applications (such as
django.contrib.admin) and works pretty well. I usually use generic names likeindex.htmlin template root for project-specific files (e.g. the index of the whole site).