How to display all session variables in django?

satch_boogie picture satch_boogie · Sep 20, 2017 · Viewed 13.7k times · Source

How to display all session variables ? i know that a variable can be accessed using request.session['variable'] but i wanted to know if there other variables that are set by others or set automatically during user logins or similar other events..

Answer

satch_boogie picture satch_boogie · Sep 21, 2017

As referred by Daniel in comment.:

for key, value in request.session.items():
    print('{} => {}'.format(key, value))

helpful answer: here and django docs