我需要根据
中渲染的页面更改base.html的标题{% 块内容 %}
您必须首先在base.html 上添加“块标题”
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My app - {% block title %}{% endblock %}</title>
</head>
<body>
{% block content %}{% block title %}
</body>
</html>
然后调用的时候就可以更改了
{% extends 'base.html' %}
{% load static %}
{% block title %}My new title{% endblock title %}
{% block content %}
<p>My new content</p>
{% endblock content %}