Python 烧瓶不';不匹配路线
我有一个链接到RESTful资源的路由:Python 烧瓶不';不匹配路线,python,flask,flask-restful,Python,Flask,Flask Restful,我有一个链接到RESTful资源的路由: api.add_resource(File, '/api/files/<int:id>') 我得到: "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. You have requested this URI [/api/files/89] but
api.add_resource(File, '/api/files/<int:id>')
我得到:
"The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. You have requested this URI [/api/files/89] but did you mean /api/files/<int:id> or /api/files or /api/users/<int:id> ?"
没有查询参数,一切正常
问题在哪里?我解决了问题。这与路由器无关,相反,我弄乱了视图逻辑。我解决了这个问题。这与路由器无关,而是我弄乱了视图逻辑。看起来您的密钥不是url编码的。我相信那些
字符需要正确编码。@sytech您可以直接在浏览器开发工具中尝试:'.==encodeURIComponent('.')
给出真
。因此,
不需要以某种方式进行编码。@Lelsoos,您能为我们提供错误消息中提到的其他路由吗?@IvanVelichko您想要实现此路由还是您的确切意思?@Lelsoos,只需要像这样的定义api.add_资源(文件,“/api/files/”)
。看起来您的密钥不是url编码的。我相信那些
字符需要正确编码。@sytech您可以直接在浏览器开发工具中尝试:'.==encodeURIComponent('.')
给出真
。因此,
不需要以某种方式进行编码。@Lelsoos,您能提供错误消息中提到的其他路由吗?@IvanVelichko您想要实现此路由还是您的确切意思?@Lelsoos,只需要像这样的定义api.add_资源(文件,/api/files/)
。
"The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. You have requested this URI [/api/files/89] but did you mean /api/files/<int:id> or /api/files or /api/users/<int:id> ?"
/api/files/89