Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Flask Basics Templates and Static Files Template Inheritance

Sam Akers
Sam Akers
4,744 Points

Can't extend "layout.html"

For some reason I can only see "Hello from Sam" printed on the page.

"Brought to you by the fine folks at Treehouse!" does not render at all.

Within the templates folder I have add.html ,index.html and layout.html

Outwith this folder is app_flask.py


{% extends "layout.html" %}

{% block title %}Howdy!{% endblock %}

{% block content %}
<h1>Hello from {{ name }}!</h1>
{% endblock %}


<!DOCTYPE html>
    <title>{% block title %}{% endblock %}</title>
    {% block content %}{% endblock %}
    <p>Brought to you by the fine folks at Treehouse!</p>

1 Answer

Copied your you files exactly as you have typed and I seem to get a different result. With that in mind I think your code is probably correct, which leads me to think that you should try one of the two things first

  1. Copy the code from here and save each file and then reload if you are still running app.py or
  2. Restart your dev server (which is just CTRL + C) and then run python app.py again