The method is not allowed for the requested URL.

Today, I had an error while working on one of my web app made with Flask. I got this error:

Method Not Allowed The method is not allowed for the requested URL.

The simple solution is to put methods=['GET', 'POST'] in the app route. Like so:

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

It fixed the problem right away. Now, I can continue to work on deploying my machine learning model on the world “wild” web!