base.html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<h1>模板继承</h1>
{% block content %}{% endblock %}
{% block footer %}
<hr>
<p>欢迎访问我的csdn.</p>
{% endblock %}
</body>
son.html
{% extends 'base.html' %}
{% block title %}自我介绍{% endblock %}
{% block content %}我叫 {{ name }}.{% endblock %}
view.py
def myname(request):
return render_to_response('son.html',{'name':'tang05709'})