可能重複:
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