Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Flask Basics!
You have completed Flask Basics!
Preview
With routes and views under our belts, it's time to see how Flask handles one of the major requirements for the web, HTML.
Things to Remember
- Use
{{and}}to print items in templates. - Flask looks for templates in a directory named
templatesby default. This directory should be in the same directory as your app script.
Docs
- Flask docs on templates
- Jinja2 - The template engine used by Flask.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
This works fine for really small stuff,
but no one wants to
0:00
write all the HTML required for an entire
view every single time.
0:02
Flask knows this, so
0:06
it gives us a great function called Render
Template that renders templates.
0:07
Let's go check it out.
0:11
So I'm a big fan of doing things the hard
way first.
0:12
It helps you to understand what's going
on, and
0:15
to appreciate the easier way a little bit
more.
0:18
So let's do this the hard way first.
0:22
Let's make our ad view here send back real
HTML.
0:26
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up