By default, routes only respond to GET requests. You can change this behavior by supplying the methods argument to the route() decorator.
from flask import request
@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
do_the_login()
else:
...