render_template的**local()参数

2. 传递全部的本地变量给template,使用**locals():

@app.route('/')
def index():
  content ='.....'
 user='Micheal'
  returnrender_template('index.html', **locals())

template中可以直接使用{{content}}和{{user}}直接操作变量。

猜你喜欢

转载自blog.csdn.net/thone00/article/details/78943117