[英]In Django, how do I reference one template from another one?
I'm using Django and Python 3.7. 我正在使用Django和Python 3.7。 I have these two files ... 我有这两个文件......
appname/templates/appname/base.html
appname/templates/appname/navigation.html
In my base.html file, I try and include the navigation template like so 在我的base.html文件中,我尝试包含这样的导航模板
{% include "navigation.html" %}
However, when I restart my Django app, I get this error 但是,当我重新启动我的Django应用程序时,我收到此错误
TemplateDoesNotExist at /navigation.html
How do I reference my navigation template from my base template? 如何从我的基本模板中引用我的导航模板?
Have you tried adding the folder name which it is located under: eg 您是否尝试添加它所在的文件夹名称:例如
{% include 'appname/navigation.html' %} {%include'appname / navigation.html'%}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.