在学习django的模板继承时,使用hello.html继承base.html时,出现<ExtendsNode: extends “base.html”> must be the first tag in the template报错,从报错的提示来看,django模版继承的语法应该是要把
{% extends "base.html" %}
这一语句放在hello.html文件的开头。
按照这个修改之后,打开localhost:8000/hello,网页正常打开,问题解决。
在学习django的模板继承时,使用hello.html继承base.html时,出现<ExtendsNode: extends “base.html”> must be the first tag in the template报错,从报错的提示来看,django模版继承的语法应该是要把
{% extends "base.html" %}
这一语句放在hello.html文件的开头。
按照这个修改之后,打开localhost:8000/hello,网页正常打开,问题解决。