python - Flask - 从函数获取路由 URL

标签 python flask

@app.route('/this/is/the/url')
def some_exposed_func():
    return render_template("data.html")

如何从 some_exposed_func 句柄中获取 '/this/is/the/url'?

print 'The func URL is: %s' % get_flask_route_url(some_exposed_func)

最佳答案

找到我自己:url_for() 就是答案

关于python - Flask - 从函数获取路由 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13447420/

相关文章:

python - 在 Plotly 中创建具有共享 Y 轴的 fiddle 图和散点图

python - 使用 cmake 构建 Opencv 给出涉及 c++11 的错误

python链表向后移动和向前移动

python - 使用 flask_pymongo 时身份验证失败

python - 如何使用 flask 和 html 返回在下拉列表中选择的值列表

Python Flask 应用程序无法解析 XML 请求数据

python - 在keras中 reshape 数组

python - 将数据 reshape 为 'closest square'

python - 如何安装 WTForms?尝试导入表单时出现导入错误

python - Flask 查询 MongoLab 的速度非常慢