简体   繁体   English

python flask URL 错误:'在服务器上找不到请求的 URL。 如果您手动输入了 URL,请检查您的拼写并重试。

[英]python flask URL error: 'The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.'

When I try to apply the url route I got this error.当我尝试应用 url 路由时,出现此错误。 Here is the code:这是代码:

from flask import Flask
from flask_restplus import Resource, Api

app = Flask(__name__)
api = Api(app)

@api.route('/GET/collections/<id>/<year>?q=<query>')
class DataRetrive(Resource):
    def get(self,id, year, query):
        return 'yes'

if __name__ == '__main__':
    app.run(debug=True)

I think you don't need specify the query parameter "q"我认为您不需要指定查询参数“q”

try something like this:尝试这样的事情:

from flask import Flask, request
from flask_restplus import Resource, Api

app = Flask(__name__)
api = Api(app)

@api.route('/GET/collections/<id>/<year>')
class DataRetrive(Resource):
    def get(self,id, year):
        q = request.args.get('q')
        return 'yes'

if __name__ == '__main__':
    app.run(debug=True)

Pay attention to the country parameter that you have not defined ...注意你还没有定义的国家参数...

So your url looks like this:所以你的网址看起来像这样:

localhost:5000/GET/collections/1/2020?q=something本地主机:5000/GET/collections/1/2020?q=something

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 FLASK - 在服务器上找不到请求的 URL。 如果您手动输入 URL 请检查您的拼写并重试 - FLASK - The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again 在服务器上找不到请求的 URL。 如果您手动输入了 URL,请检查您的拼写并重试。 404 - The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. 404 Python Flask API:在服务器上找不到请求的 ZE6B391A8D2C4D45902A23A8B6587。 如果您手动输入 URL 请检查您的拼写并重试 - Python Flask API : The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again Flask 应用程序 - 错误 404,在服务器上找不到请求的 URL。 如果您手动输入了 URL,请检查您的拼写并重试 - Flask app - Error 404, The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again Flask 错误:在服务器上找不到请求的 URL。 如果您手动输入 URL 请检查您的拼写并重试 - Flask error: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again 在服务器上找不到请求的 URL。 如果您手动输入 URL,请检查您的拼写并重试 - The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again Flask - 404 未找到:在服务器上未找到请求的 URL。 如果您手动输入 URL,请检查您的拼写并重试 - Flask - 404 Not found : The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again Flask: Not Found 在服务器上找不到请求的 URL。 如果您手动输入了 URL,请检查您的拼写并重试 - Flask: Not Found The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again Flask: Not Found 在服务器上找不到请求的 URL。 如果您手动输入 URL,请检查您的拼写并重试 - Flask: Not Found The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again 为什么我会收到“在服务器上找不到请求的 URL。如果您手动输入了 URL,请检查您的拼写并重试” - Why am I getting "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM