I can't get redirect to work on netlify despite the app working locally

@Abi2023 When the user enters the value into the input and hits submit, and the form does a POST to the /, what do you believe is receiving the posted value and responding?

Because if it’s this code in your app.py:

@app.route("/", methods=("GET", "POST"))
def index():
    if request.method == "POST":

Then you’ve misunderstood the type of hosting that is available with Netlify.

There’s no runtime server with python, or any of the other languages available.

Your build should execute, produce a static output that can be deployed to CDN, and then any runtime functionality needs to be achieved either via Serverless Functions or a server that you host elsewhere.