gpt4 book ai didi

python-3.x - Sanic 是否具有 'url_for()' 函数(如在 flask 中)?

转载 作者:行者123 更新时间:2023-12-04 17:32:07 25 4
gpt4 key购买 nike

我正在尝试将一个简单的 flask 应用程序移植到 sanic,使用 sanic and jinja 的示例.

sanic 有没有 url_for()功能像 flask ?

最佳答案

更新 : Sanic 0.3.1 增加了对 url_for() 的支持:

url = app.url_for('post_handler', post_id=5, arg_one='one', arg_two='two')

不可以。目前sanic的路由器非常基础,不支持查找。您可以在此处查看简短的源代码: https://github.com/channelcat/sanic/blob/master/sanic/router.py

关于python-3.x - Sanic 是否具有 'url_for()' 函数(如在 flask 中)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41339970/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com