Skills Expanded

Add Error Handling to a Flask CMS

What you'll learn

Python & Flask are great for building a web applications. In this project you’ll utilize logging, signals and error handlers to make an existing content management system more resilient.

Table of contents

Setup
25m
  • Set up your local environment for projects. We'll walk you through everything you need to know, including how to install and configure your environment to be able to complete all of the tasks.
Access Log
15m
  • In this module we'll create a function to configure logging. The function creates and configures a rotating file handler. This function will then be used to configure an access log. Then using an after request decorator we'll write all requests to this access log.
Error Log
20m
  • In this module we'll handle 404 and 500 errors. When these errors happen the user will be redirected to the appropriate template. The 500 errors will also be logged to an error log.
Unauthorized Log
10m
  • In this module we'll create a signal that writes unauthorized login attempts to a log file.

About the author

Tom is a staff author at Pluralsight helping to develop Hands-On content. Tom's background in software development, UI/UX, and instructional design was developed over the years while working as a faculty member at the School of Computing at Weber State University in Utah, and continues to grow as he develops Projects and Labs for Pluralsight. When he's not creating content to allow learners to gain real-life experience, he enjoys spending time with his family.

Ready to upskill? Get started