How do I add a key to the "session" dictionary that will be available when the program starts?

Flask's context variable - session - is useful for passing values ​​across a program (especially between Flask and Jinja2 in my case). How do I add a key to this dictionary at the beginning of my program (even before accessing any route or view function) so that I can use it throughout the life of the program?

For example, I want to add a user dict to this variable like this:

session['user'] = {}

      

and update (by adding or removing keys) with values ​​at run time.

+3


source to share





All Articles