I'm trying to understand why my template, even though copied from a working "login" html and py file, doesn't render for "quote".

It just goes straight to return apology.. while the same code works in login, which allows me for an input before it executes apology.

python file:

app.route("/quote", methods=["GET", "POST"])
def quote():
    """Get stock quote."""

    if request.method == "GET":
        if not request.form.get("symbol"):
            return apology("provide a symbol")


{% extends "layout.html" %}

{% block title %}
{% endblock %}

{% block main %}
    <form action="{{ url_for('quote') }}" method="get">
            <div class="form-group">
                <input autocomplete="off" autofocus class="form-control" name="symbol" placeholder="Symbol" type="text"/>

            <div class="form-group">
                <button class="btn btn-default" type="submit">Quote</button>
{% endblock %}

1 Answer 1


In python file change if request.method == "GET" to if request.method == "POST" and also alter the method = "get" attribute in html form of quote.html to method = "post".

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .