Problem with Flask: don’t have a redirect to a new page

I have this:


 from flask import Flask, render_template, request, url_for, redirect 
 import pyodbc  # Libreria conexión ODBC para Python 
 import locale 
 import pandas as pd 
 app = Flask(__name__)

def index():
     return render_template("index.html")
 @app.route("/", methods=["GET", "POST"]) 
 def request():
     pedido = request.args.get['pedido']
     cliente = request.args.get['cliente']
     return redirect(url_for('coste_transporte', pedido=pedido, cliente=cliente))
 @app.route("/<int:pedido_sap>", methods=["GET", "POST"])
 def coste_tranporte(pedido_sap, cliente_final):
     return render_template("pedido.html")

I try to show a index.html in the url "localhost:5000", and when the user complete the form with a input named "pedido" and check "Yes or no" radio button, redirect to url "localhost:5000/123456789" when "123456789" is the number of "pedido".

Thank you.

Read more here:

Content Attribution

This content was originally published by Carlos Porcel at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: