Hi,
I have written my first Flask app and everything works fine with GET requests but POST and PUT are returning 405 errors (checked with browser and curl -X POST)
App has been reloaded several time and checked the latest version is running by changing the return value on GET requests.
86.98.213.164 - - [24/Oct/2016:07:04:12 +0000] "GET / HTTP/1.1" 200 9 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" "86.98.213.164"
86.98.213.164 - - [24/Oct/2016:07:06:17 +0000] "PUT / HTTP/1.1" 405 178 "-" "curl/7.49.0" "86.98.213.164"
23.227.37.104 - - [24/Oct/2016:07:11:40 +0000] "POST / HTTP/1.1" 405 178 "-" "Ruby" "23.227.37.104"
86.98.213.164 - - [24/Oct/2016:07:15:00 +0000] "PUT / HTTP/1.1" 405 178 "-" "curl/7.49.0" "86.98.213.164"
86.98.213.164 - - [24/Oct/2016:07:15:09 +0000] "GET / HTTP/1.1" 200 9 "-" "curl/7.49.0" "86.98.213.164"
86.98.213.164 - - [24/Oct/2016:07:16:06 +0000] "GET / HTTP/1.1" 200 9 "-" "curl/7.49.0" "86.98.213.164"
Code as follows. Nothing of note to my mind in the access or error log, except the 405 recorded in the access log:-
from flask import Flask
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST', 'PUT'])
def main():
return "Done sir!"