0
我有一些第三方库,默认情况下,该库中的模板将被屏蔽。找不到Django模板,但存在文件
我想替换布局模板,从中开始所有其他的继承。
所以,在我的本地应用程序创建新layout.html
文件,该文件内容 {% extends 'library:layout.html' %}
但在这种情况下,我已经得到了 TemplateDoesNotExist at /test-url/ test.html
但还是模板装载机抛尸显示,它可以找到文件:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/path/to/app/templates/test.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/path/to/library/app1/templates/test.html (File does not exist)
/path/to/library/app2/templates/test.html (File does not exist)
/path/to/library/app3/templates/test.html (File exists)
所以,在图书馆app3
Django的发现TEM板,但由于某种原因,不要使用它。你能帮助解决这个问题吗?
谢谢。
'layout.html'模板位于何处? – Alasdair
@Alasdair它只是在根目录'/ templates /'目录中。基本上,关于你的回答,我已经尝试过像'{%extends'layout.html%}一样的扩展,但是仍然例外是关于另一个由view调用的模板。 –