How to display all session variables in django?

Viewed 18903

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

2 Answers

As referred by Daniel in comment.:

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

helpful answer: here and django docs

You can try like this

 for key in request.session.keys():
        print "key:=>" + request.session[key]
Related