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 ...

Get Flask: Building Python Web Services now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.