我想在烧瓶路线中返回 html

5 python flask

我想使用html('<h1>content</h1>')类似 jsonify 之类的东西,而不是使用send_static_file。

@app.route('/incorrect_pass')
def incorrect_pass():
    return html('Incorrect password. <a href="/">Go back?</a>')
Run Code Online (Sandbox Code Playgroud)

是我想做的。

小智 6

没关系。应该检查一下。Flask 以 html 形式返回字符串,因此html()上面不需要。