pythondjangodictionarysessiondjango-sessions

How to display all session keys and values in Django?


How can I display all session keys and valuesv? I know that the value can be accessed with request.session['key'] but I want to know if there are other values that are set by others or set automatically during user logins or similar other events..


Solution

  • As referred by Daniel in comment.:

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

    helpful answer: here and django docs