from flask import request, Flask, render_template app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) def hello_world(): if request.method == 'GET': return render_template('index.html') elif request.method == 'POST': return request.form @app.errorhandler(405) def method_not_allowed(e): return render_template('405.html'), 405