[英]Django template not found but file exist
I have some third-part library, templates from that library is diplayed by default. 我有一些第三方库,默认情况下会显示该库中的模板。
I want to replace layout template, from which all other start inheritance. 我想替换布局模板,从该模板开始所有其他继承。
So, in my local app I create new layout.html
file, which contents {% extends 'library:layout.html' %}
因此,在我的本地应用程序中,我创建了一个新的
layout.html
文件,其中的内容{% extends 'library:layout.html' %}
But in that case I've got TemplateDoesNotExist at /test-url/ test.html
但是在那种情况下,我
TemplateDoesNotExist at /test-url/ test.html
有TemplateDoesNotExist at /test-url/ test.html
But still Template-loader postmortem display, that it can find file: 但是仍然显示Template-loader验尸 ,它可以找到文件:
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)
So, in library app3
Django found template, but for some reason do not use it. 因此,Django在库
app3
找到了模板,但由于某些原因,请勿使用它。 Can you help with this issue? 您可以解决这个问题吗?
Thanks. 谢谢。
Make sure that there isn't another missing template that is causing the error. 确保没有其他丢失的模板导致该错误。
Your extends
tag looks wrong. 您的
extends
标签看起来不对。 I would expect to see library/layout.html
, not library:layout.html
我希望看到
library/layout.html
,而不是library:layout.html
{% extends 'library/layout.html' %}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.