405 Method Not Allowed in Flask

It is due to server mis-configulation at almost all times. In my case, I allowed POST methods for form.

Before:

@app.route('/')
@app.route('/login', methods=["GET", "POST"])
def login(id):
    print(request.method)
    # do something
    return "page"

After:

@app.route('/', methods=["GET", "POST"])
@app.route('/login', methods=["GET", "POST"])
def login(id):
    print(request.method)
    # do something
    return "page"



コメント

人気の投稿