include 和 set语句
include
{% include 'xxx.html' %}
set 赋值语句
{% set name='xxx' %} 全局
{% with %}
{% set name = 'xxx' %}
{% endwith %}
{% with xxx = 'xxx'%} 局部
{% endwith %}
模板继承
模板导入
{% extends 'xxx.html %}
{% block footer %}
{% endblock %}
加载静态资源文件
- 静态资源文件夹:
- static/css/xxx.css
-
<link rel="stylesheet" href="{{ url_for('static', filename='css/base.css') }}">
- static/js/xxx.js
-
<script src="{{ url_for('static', filename='js/index.js') }}"></script>
- static/image/xxx.jpg