可能重复:
Django view - load template from calling app's dir firstDjango的模板名称冲突
我有许多应用Django项目。其实文件结构如下:
myproj/
default/
templates/
index.html (1)
app1/
templates/
index.html (2)
app2/
templates/
index.html (3)
我预计,活跃应用程序的模板目录具有最高的优先级,当模板解决。但实际上,我根据INSTALLED_APPS命令获得了第一个模板! 如果我更改安装的应用程序的顺序 - 相应地更改模板。
问题:有没有办法从当前应用程序中首先获取模板?模板名称/显式目录规范的唯一性是实现它的唯一方法吗?
你可能想看看http://stackoverflow.com/questions/3092865/django-view-load-template-from-calling-apps-dir-first – Rohan 2012-07-13 13:00:22
谢谢,就是这样。 – 2012-07-13 14:34:48