NameError: name 'escape' is not defined

昨天在学习flask的时候,发现这个问题

官方提供的代码:

@app.route('/user/<username>')
def show_user_profile(username):
    # show the user profile for that user
    return 'User %s' % escape(username)

说是escape没有定义,所以在之前记得导入就好了

from flask import Flask, escape

就可以正常运行了

发布了119 篇原创文章 · 获赞 14 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/qq_38115310/article/details/102841672