为什么django模板中的{%block contents%}不返回任何内容?

为什么django模板中的{%block contents%}不返回任何内容?,django,django-templates,Django,Django Templates,我在尝试显示标记中的内容时遇到问题。所以我希望Content.html中的表单显示在Base.html中,但它不会显示。 Base.html <div class="jumbotron text-center"> <h1>Upload Data</h1> </div> <div class="Container"> {% block content %} {% endblock %} </

我在尝试显示标记中的内容时遇到问题。所以我希望Content.html中的表单显示在Base.html中,但它不会显示。

Base.html

<div class="jumbotron text-center">
<h1>Upload Data</h1>
</div>
<div class="Container">
{% block content %}
{% endblock %}
</div>
<div>
<footer class="container-fluid">
    <p>Footer Text</p>
</footer>
</div>
</body>
和views.py:

def Content(request):
   return render(request,'Warehouse/Content.html')

def Base(request):
   return render(request,'Warehouse/Base.html')

如果您有任何建议,我们将不胜感激,谢谢您

我不确定这是否有帮助,但有两件小事。使用endblock标记,在其后面键入块名,以便显式显示,如“endblock内容”。另一件事是,如果您的代码与上面的代码匹配,那么在此行的第一个括号之后就有一个额外的空间需要删除:{%extends'WareHouse/Base.html%}
urlpatterns = [
   path('',Content),
   path('Base/',Base)
]
def Content(request):
   return render(request,'Warehouse/Content.html')

def Base(request):
   return render(request,'Warehouse/Base.html')