Python Django:在HTML中注册或加载{%block content%}标记
我正在尝试扩展我的模板 base_layout.html: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
{% 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?