Home > Mobile >  Flask app.route always giving 404 errors except /
Flask app.route always giving 404 errors except /

Time:01-09

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 -

CodePudding user response:

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.

  •  Tags:  
  • Related