gpt4 book ai didi

python - Django接受QueryParams(必须是可调用错误)

转载 作者:太空宇宙 更新时间:2023-11-03 21:21:35 25 4
gpt4 key购买 nike

我希望http://example.com/view_item/4通过传递对象ID来处理所选对象的 View ,但是在尝试了我在网上找到的每个组合之后什么有效,我仍然收到以下错误:

TypeError: view must be a callable or a list/tuple in the case of include().

这是我的路:

 url(r'^view_item/(?P<query>\w+)$','view_item')]

我已经验证了正则表达式,我已经尝试过不使用正则表达式。

最佳答案

正如错误所述,我忘记包含可调用 View 。我的困惑来自于学习资源的混合方法。

工作路径示例:

url(r'^view_item/(?P<query>\w+)$',view_item, 'view_item')]

关于python - Django接受QueryParams(必须是可调用错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54190650/

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