简体   繁体   中英

Flask app.route always giving 404 errors except /

I have a Flask app that kept giving 404 error on any route other than /

 33     @app.route("/")
 34     def hello_world():
 35         return "Hello, Faiss Flask!"
 36
 37     @app.route("/echo", methods=["POST"])
 38     def echo():
 39         return flask.jsonify(request.data)
 40

Then I use Postman to try on the service. In the console log I got:

faissflask_1  | INFO:werkzeug:172.19.0.1 - - [06/Jan/2022 06:19:45] "GET / HTTP/1.1" 200 
faissflask_1  | INFO:werkzeug:172.19.0.1 - - [06/Jan/2022 06:21:52] "POST /echo HTTP/1.1" 404 -

I just figured out the root cause. I was running it with docker-compose up which only attaching the existing images rather than build on any updates to the service code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM