二、摸版
摸版
Jinja2摸版
mkdir templates
echo '<h1>Hello, World!</h1>' > templates/index.html
echo '<h1>Hello, {{ name }}!</h1>' > templates/user.html
(myproject) [root@localhost myproject]# python app.pyfrom flask import Flask, render_template
app = Flask(__name__)
app.debug = True
@app.route('/')
def index():
return render_template('index.html')
@app.route('/user/<name>')
def user(name):
return render_template('user.html', name=name)
if __name__ == '__main__':
app.run(host='0.0.0.0',port=8080)变量过滤器
过滤器名
说 明
IF控制器
For控制器
宏控制器
摸版继承
集成 Bootstrap
使用 Flask-Bootstrap 的模板

块 名
说 明
自定义错误页面
链接
静态文件
使用Flask-Moment本地化日期和时间
Last updated