视图函数:



@app.route("/extend") def extend(): return render_template("extend.html")

基础:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<p>this is json</p>
<p>
{% if user %}
    {{ user.qq }}
    {% endif %}
</p>
<p>
    {% for i in list %}
        {{ i }}
    {% endfor %}
</p>
{% block content %}
{% endblock content %}
</body>
</html>

继承:

{% extends "index.html" %}
{% block content %}
    <h1>hello 9980</h1>
{% endblock content %}

 

结果:

 

 

 

 很显然,仅仅替换了动态数据

 

posted on 2020-06-21 15:14  topass123  阅读(226)  评论(0编辑  收藏  举报