How to add a new route to the existing Flask app

61 Views Asked by At

I am newbie with Flask and trying to add a new route to Lama Clearner.

Existing routes work perfectly in my localhost but I added the below code

@app.route("/get_ping")
def get_ping():
    return str(True), 200

But when I try to make the request with http://localhost:8080/get_ping, I get 404 error. Am I missing something?

Thanks!

1

There are 1 best solutions below

0
TanThien On

Your flask app is used another port to run. You must register app port in app.run. Ex:

app.run(
        host='0.0.0.0',
        threaded=True,
        port=8080,
        use_reloader=False,
    )