立即学习:https://edu.csdn.net/course/play/27093/354192?utm_source=blogtoedu
关键字endpoint在app.route()中定义url的名称,使用后使用url_for()反转函数时,若参数为定义的函数名则会报错,应为自定义的endpoint
如
app.route('/', endpoint='index')
def hello_world():
return 'hello world'
app.route('/test')
def test():
return url_for('hello_world')
以上为错误示范,应将 return url_for('hello_world')改为 return url_for('index')或者把app.route('/', endpoint='index')中的endpoint去掉