继承:

usrs.py

from django.conf.urls import url
from mytest import views

urlpatterns = [
    url(r'^t1.html', views.t1),
    url(r'^t2.html', views.t2),
]

views.py

def t1(request):
    return render(request, 't1.html')


def t2(request):
    return render(request, 't2.html')

master.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .tt{
            background-color: #c00036;
            border: 1px solid yellow;
        }
    </style>
</head>
<body>
    <div class="tt">模版继承</div>
    {% block test %} {% endblock %}
</body>
</html>

t1.html

{% extends 'master.html' %}
{% block test %}
    <h1>你好</h1>
{% endblock %}

t2.html

{% extends 'master.html' %}
{% block test %}
    <h1>世界</h1>
{% endblock %}

  

效果:

 

 导入: