我的web應用程序的代碼當前位於保管箱中,在工作和家庭計算機上工作時,只需更改settings.py模塊中的TEMLPLATE_DIRS變量即可。Django TEMPLATE_DIRS在錯誤的目錄中查找?
我今天晚上遇到了一個問題,當啓動應用程序。我得到一個錯誤TemplateDoesNotExist,下面是詳細信息:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/Users/me/Dropbox/app/MyApp/Users/me/Dropbox/app/MyApp/templates/App/Page 1/pageone.html (File does not exist)
基本上第一/用戶/我/ Dropbox的/應用程序/ MyApp的不應該在那裏。
settings.py
TEMPLATE_DIRS = (
"Users/danielholmes/Dropbox/app/MyApp/templates/",
)
這將是愚蠢的東西,我認爲 - 請讓我知道,如果需要更多的信息。
非常感謝
你累了嗎?「/ Users/danielholmes/Dropbox/app/MyApp/templates /」?在開頭用'/'.. –
你能否也請告訴我們你是如何在視圖中定義模板名稱的? –
缺少「/」是問題的原因 – Sherlock