Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Flask Basics Templates and Static Files Template Inheritance

miguel soriano
miguel soriano
2,177 Points

Flask basics template inheritance

Good day, I would like to get some help how to solve the problem. I already added the Smells like Bakin but Im not sure whats wrong. Make sure the <title> tag still has its title. "Smells Like Bakin'" should be in the block, too.

from flask import Flask
from flask import render_template

app = Flask(__name__)

def index():
    return render_template('index.html')
{%extends 'layout.html'%}

{%block title%}
Smells Like Bakin

{%block content%}
<p>Welcome to my bakery web site!</p>
<!doctype html>
    <title>{% block title %}{% endblock %}</title>
    {%block content%}
    {%endblock %}

1 Answer

Josh Keenan
Josh Keenan
19,426 Points

I believe you have stumbled at stage three, and the mistake you have made is that you have removed this from your content block:

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

In the layout file, "Smells Like Bakin'" is the title, but in this file it is originally a <h1> that resided in the body.

Hope this helps