I am using flask for the first time and jinja code is being displayed on the webpage. this is my html file:

    <!DOCTYPE html>

    <html lang="en">
             <link href="https://fonts.googleapis.com/css2? 
             family=Montserrat:wght@500&display=swap" rel="stylesheet">
             <link href="/static/styles.css" rel="stylesheet">
             <div class="jumbotron">
             <div class="container">
                 <div class="section">

                     <h2>Add a Birthday</h2>
                <input type="text" autocomplete="off" spellcheck="false" placeholder="Name" name="name">
                <input type="number" placeholder="Month" max="12" min="1" id="month">
                <input type="number" placeholder="Day" min="1" max="31" id="day">
                <input type="submit" value="Add Birthday">

        <div class="section">

            <h2>All Birthdays</h2>
                    <!-- TODO: Loop through the database entries to display them in this table -->
                        <tr><th>{{ name }}</th></tr>


it looks like that the browser is not understanding jinja even though i am using flask. this is application.py:

    import os

    from cs50 import SQL
    from flask import Flask, flash, jsonify, redirect, render_template, request, session

    # Configure application
    app = Flask(__name__)

    # Ensure templates are auto-reloaded
    app.config["TEMPLATES_AUTO_RELOAD"] = True

    # Configure CS50 Library to use SQLite database
    db = SQL("sqlite:///birthdays.db")

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

    # TODO: Add the user's entry into the database
    name = request.form.get("name").value
    return render_template("index.html" ,name=name)
    return redirect("/")


    # TODO: Display the entries in the database on index.html

    return render_template("index.html")
  • Please edit the question and include how name is created in application.py. Commented Sep 20, 2021 at 22:43

1 Answer 1


This name = request.form.get("name").value is going to throw an Attribute Error, which indicates the POST branch doesn't run. (the get returns a string, and a python string does not have a value attribute.)

A POST request is never submitted; <form> element needs a method attribute.

You must log in to answer this question.

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