Steps:
- 创建一个文件夹
- 在文件夹下,create a python file, named “app.py”
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html', data=[{
'description': 'Todo 1'
}, {
'description': 'Todo 2'
}, {
'description': 'Todo 3'
}])
- In the project folder, create a new folder named “templates”. Under the templates folder, create an index.html file.
Todo app
-
{% for d in data %}
- {{ d.description }} {% endfor %}
- Run the app.py file with this command:
$ FLASK_APP=app.py FLASK_DEBUG=true flask run
- 得到的结果



