我的休息服务位于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.
这是为什么?我希望我的服务器显示一些状态消息,例如“服务就绪”。
当我按“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)
天涯尽头无女友
相关分类