from flask import Flask,render_template
app = Flask(__name__)
@app.route('/')
def hello_world():
return render_template('include.html')
if __name__ == '__main__':
app.run(debug=True)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>知了課堂</title>
#主模板
</head>
<body>
{% include 'common/header.html' %}
<div class="context">
中間的
</div>
{% include 'common/footer.html' %}
</body>
</html>

#header公用的部分封裝起來
<style>
.nav ul {
overflow: hidden;
}
.nav ul li{
float: left;
margin: 0 20px;
list-style-type: none;
}
</style>
<nav class="nav">
<ul>
<li>首頁</li>
<li>課程詳情</li>
<li>視頻教程</li>
<li>關於我們</li>
</ul>
</nav>
#footer公用的部分封裝
<div class="footer">
末尾的
</div>
