O'Reilly logo

Flask Framework Cookbook by Shalabh Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Flashing messages for better user feedback

An important part of all good web applications is to give users feedback about various activities. For example, when a user creates a product and is redirected to the newly created product, then it is a good practice to tell the user that the product has been created.

Getting ready

We will be adding the flash messages functionality to our existing catalog application. We also have to make sure that we add a secret key to the application, because the session depends on the secret key, and in the absence of the secret key, the application will error out while flashing.

How to do it…

To demonstrate the flashing of messages, we will flash messages on the creation of products. First, we will add a secret key to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required