我想在烧瓶路线中返回html [英] I want to return html in a flask route

查看:72
本文介绍了我想在烧瓶路线中返回html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Instead of using send_static_file, I want to use something like html('<h1>content</h1>'), sort of like jsonify.

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

这就是我想要做的.

推荐答案

没关系.应该检查一下.Flask将字符串返回为html,因此上面不需要 html().

Never mind. Should've checked. Flask returns strings as html, so the html() isn't necessary above.

这篇关于我想在烧瓶路线中返回html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆