url_for解析报错

来源:2-1 模板及模板引擎介绍

QXY_DZ

2022-10-30 10:31:19

@app.route('/index/')
def Index():
   index = make_response('需要在页面上显示的内容(Index.html)', 200, {
       'key1': 'value1',
       'key2': 'value2'
   })
   return index


@app.route
('/urlfor/')
def Test_urlfor():
   print(url_for('index', _external=True))
   return render_template('render_template.html')

https://img.mukewang.com/climg/635de17809ff1a1e13981351.jpg

url_for函数解析报错

这是什么问题呢?

写回答

1回答

时间,

2022-10-30

同学,你好!url_for()的第一个参数为函数名,应该是Index

https://img.mukewang.com/climg/635de72c09442e1108570412.jpg

祝学习愉快!

0

0 学习 · 2433 问题

查看课程