I am missing basic and can not get my html page to populate with the data I have correctly generated

I need to look up a stock price and then display it on an quoted.html. I generate the data correctly in my function, but can not get my html page to read the data. Here is my function:

@app.route("/quote", methods=["GET", "POST"])
def quote():
    """Get stock quote."""
    if request.method == "POST":
        # Ensure ticker was submitted
        if not request.form.get("symbol"):
            return apology("must input stock symbol")

            # Get symbol and make sure it exists
            symbol = request.form.get("symbol")
            quote = lookup(symbol)
            if not quote:
                return apology("symbol does not exist")
                # to show company name and price

                print(quote["name"], quote["price"])

                return render_template("quoted.html", name=quote["name"], price=quote["price"])

    # User reached route via GET (as by clicking a link or via redirect)
        return render_template("quote.html")

It is quoted.html that does not load:

{% extends "layout.html" %}

{% block title %}
    Quoted With values from lookup
{% endblock %}

{% block body %}
        One share of {{ name }} costs ${{ price }}

{% endblock %}

I thought I was following the example from the class notes, but I get a blank screen after I put in a stock ticker and ask for the quote, but I can see that the quote is correctly done. I think my routing must be incorrect, but am at a loss. Thanks for any help.

Read more here: https://stackoverflow.com/questions/67479785/i-am-missing-basic-and-can-not-get-my-html-page-to-populate-with-the-data-i-have

Content Attribution

This content was originally published by JerryCinc 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: