1. 加载静态文件
html顶部:{% load staticfiles %}
调用:
<link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap-theme.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/base.css' %}">
<script type="text/javascript" src="{% static 'js/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/bootstrap.min.js' %}"></script>
templates文件位置:myproject/templates
static文件位置:myproject/app1/static/css/base.css
2. 继承并重写
父html: {% block mainbody %}<p>original</p>{% endblock %}
子html: {% extends "base.html" %}
{% block mainbody %}<p>继承了 base.html 文件</p> {% endblock %}