Python Flask Basics Templates and Static Files Template Inheritance

nicolem22
nicolem22
UX Design Techdegree Graduate 11,218 Points

can someone please help me! I have no clue what i am doing wrong, i have been stuck on this since last night!

i have no clue what i am doing wrong, i have tried multiple times!

flask_app.py
{%block title%}Homepage{%endblock%}{%block content%}<h1>Smells Like Bakin
'!</h1><p>Welcome to my bakery web site!</p>{%endblock%}
templates/index.html
<head><title>{% block title %}Smells Like Bakin'{% endblock %}</title></head>
templates/layout.html
{% block content %}
<h1>Smells Like Bakin'!</h1>
<p>Welcome to my bakery web site!</p>
{% endblock %}

1 Answer

Cheo R
Cheo R
37,145 Points

I it passing with this:

# flask_app.py
from flask import Flask
from flask import render_template

app = Flask(__name__)


@app.route('/')
def index():
    return render_template('index.html')
<!-- index.html -->

{% extends 'layout.html' %}
{% block title %}
    {{ super() }} Homepage
{% endblock %}

{% block content %}
    <h1>Smells Like Bakin'!</h1>
    <p>Welcome to my bakery web site!</p>
{% endblock %}
<!-- layout.html -->

<!doctype html>
<html>
<head>
  <title>
      {% block title %}
          Smells Like Bakin'
      {% endblock %}
   </title>
</head>
<body>
{% block content %}

{% endblock %}

</body>
</html>

which stage were you having trouble passing?

nicolem22
nicolem22
UX Design Techdegree Graduate 11,218 Points

OMG!!!!! you are awesome!!!! Thank You!!! and yes. it worked.