Skip to content

Files

Latest commit

Sep 7, 2021
13a659f · Sep 7, 2021

History

History

redirection

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 7, 2021
Sep 7, 2021
Sep 7, 2021
Sep 7, 2021
Sep 7, 2021
from flask import Flask, render_template, request
from werkzeug.utils import redirect

app = Flask(__name__)

@app.route('/', methods = ['GET', 'POST'])
def home():
    if request.method == 'POST':
        name = request.form.get('name')
        age = request.form.get('age')
        return redirect(f'/result/{name}/{age}')
    return render_template('home.html')

@app.route('/result/<name>/<age>')
def result(name, age):
    return render_template('result.html', name=name, age=age)

app.run()