I am using Flask in Python and I am trying to elaborate post requests on the server I am hosting (atm on localhost because I am still trying to make it work). The post message is generated in the following way: payload = {'k' : '123' } r = requests.post ('http://localhost', payload) and then the result I get is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>405 Method Not Allowed</title> <h1>Method Not Allowed</h1> <p>The method is not allowed for the requested URL.</p> At the same time, if I try to send the same request to the address localhost/post as follows r2 = requests.post ('http://localhost/post', data) the result becomes <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>404 Not Found</title> <h1>Not Found</h1> <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p> The code I am using to create the server is the following: from flask import Flask, jsonify, Request from flask.templating import render_template from flask.globals import request app = Flask(__name__) @app.route('/', methods = ['GET', 'POST']) def index (): return render_template('indexServer.html') @app.route('/post', methods =['GET', 'POST']) def post(): return render_template('response.html') if __name__ == '__main__': app.run(host = 'localhost', port = 80, debug = True) Now, while the GET method in the index function works, it doesn't when I try to get the '/post' page. I guess the reason behind this is also the same for which I get 404 above when I try to post. I'd like to understand why this is happening, as I can't figure out what is going on and what I am doing wrong. If it wasn't already obvious, I have just started working in Python with Flask so it may be anything. Thanks for your attention. Continue reading...