烧瓶与路线不匹配

时间:2016-11-21 19:05:53

标签: python flask flask-restful

我有一条链接到Flask-RESTful资源的路线:

api.add_resource(File, '/api/files/<int:id>')

如果我现在想通过

访问该路线
/api/files/89?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc0FkbWluIjp0cnVlLCJ1c2VySWQiOjEsImV4cCI6MTQ3OTg0MTcxN30.DkoPeMeXms9j0nzmEAsGKOpIi_cRyTf4m6mQJjl17o0

我得到:

"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

没有查询参数,一切正常。

问题出在哪里?

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。它不是与路由器相关的东西,而是搞砸了视图逻辑。

相关问题