1、在add.py中添加如下代码:
loop=[
'one:1',
'two:2',
'three=3'
]
title='我爱你,中国'
return render_template('index.html',title=title,data=loop)
2、在index.html中添加如下代码:
<head>
<meta charset="UTF-8">
{% if title %}
<title>{{title}}</title>
{% else %}
<title>Flask App</title>
{% endif %}
</head>
<body>
{% for p in data %}
<p>{{p}}</p>
{% endfor %}
</body>