I'm aware that you can get session variables using request.session['variable_name']
, but there doesn't seem to be a way to grab the session id(key) as a variable in a similar way. Is this documented anywhere? I can't find it.
request.session.session_key
Note the key will only exist if there is a session, no key, no session. You can use this to test if a session exists. If you want to create a session, call create.