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 with SQLAlchemy Basics!
You have completed Flask with SQLAlchemy Basics!
Preview
Create a route to handle errors in your website.
Code snippet from the video
<section id="not-found">
<img src="https://media.giphy.com/media/DvyLQztQwmyAM/giphy.gif" alt="Surprised Dog Gif">
<h2>Hmm...it seems this page can't be fetched.<i class="fas fa-baseball-ball"></i></h2>
<p>{{ msg }}</p>
<a href="{{ url_for('index') }}">
<button><i class="fas fa-home"></i><i class="fas fa-bone"></i>Go Home</button>
</a>
</section>
Learn more about Flask Error pages
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
Here's a few great 404 pages.
0:00
This is also a popular area for
0:03
a website to show off their
personality and have some fun.
0:05
On our website when you navigate
to a page that doesn't exist,
0:10
you get this plain black and
white Not Found page.
0:15
It lets the user know what happened, but
it's not the most friendly of pages, and
0:20
it doesn't match our color scheme.
0:24
Instead, let's create our own
404 page to show the user.
0:27
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