为什么这个烧瓶没有根据我的代码显示标准消息?

why is this flask not showing standard message according to my code?

我的休息服务位于 http://127.0.0.1:5000,但是当我启动它时,它给了我 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.

这是为什么呢?我希望我的服务器显示一些状态消息,例如 'service ready'.

我将使用的实际功能是可以访问和工作的,当我按 'http://127.0.0.1:5000/parser/tengrinews' 并按回车键时,它会输出我在 Flask 应用程序的功能中编码的消息:

[
  "parsing this website :", 
  "tengrinews"
]

主要代码:

from flask import Flask
import requests
from datetime import datetime
from flask import jsonify

app = Flask(__name__)

#this is my std method i can't see
@app.route("/http://127.0.0.1:5000/", methods = ['GET'])
def main():
    return jsonify('service is ready')

@app.route("/parser/<string:website>", methods = ['GET'])
def parse(website):    
    return jsonify("parsing this website :", website   )


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

更改此行 -

@app.route("/http://127.0.0.1:5000/", methods = ['GET'])

@app.route("/", methods = ['GET']).

因为您只需要指定将要使用的扩展URL。 @app.route 装饰器为我们处理剩下的事情

注意*(不要这样做。仅供娱乐)-
如果您希望继续使用 @app.route("/http://127.0.0.1:5000/", methods = ['GET']),则使用 url - http://localhost:5000/http://127.0.0.1:5000/ 访问端点。您将得到 "service is ready"

的响应