Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django:在HTML中注册或加载{%block content%}标记_Python_Html_Django - Fatal编程技术网

Python Django:在HTML中注册或加载{%block content%}标记

Python Django:在HTML中注册或加载{%block content%}标记,python,html,django,Python,Html,Django,我正在尝试扩展我的模板 base_layout.html: {% load static from staticfiles %} <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Articles</title> <link rel = "stylesheet" href = "{% sta

我正在尝试扩展我的模板

base_layout.html:

{% load static from staticfiles %}


<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Articles</title>
        <link rel = "stylesheet" href = "{% static 'styles.css' %}">
    </head>
    <body>
        <div class="wrapper">
            {% block content %}
            {% endblock %}
        </div>
    </body>
</html>

我犯了什么错误?

您在某个地方输入了一个错误(它不在您已经发布的部分中):
blockcontent
而不是
block content
。而不是使用
{%load static from staticfiles%}
。使用
{%load static%}
{% extends 'base_layout.html' %}


{% block content %}
    <h1>Article List</h1>
    <div class = "articles">
        {% for article in articles %}
        <div class = "article">
            <h2><a href = "#">{{ article.title}}</a></h2>
            <p>{{ article.body }}</p>
            <p>{{ article.date }}</p>
        </div>
        {% endfor %}
    </div>
{% endblock %}
django.template.exceptions.TemplateSyntaxError: Invalid block tag on line 11: 'blockcontent'. Did you forget to register or load this tag?