In Django, how can I find out the request.session sessionid and use it as a variable?

前端 未结 8 838
借酒劲吻你
借酒劲吻你 2020-12-13 03:08

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 sessionid as a variable

相关标签:
8条回答
  • 2020-12-13 03:56

    In Django 1.8:

    request.session.session_key

    and

    request.session._session_key

    Both work correctly.

    0 讨论(0)
  • 2020-12-13 03:57

    in Django >= 1.4 use:

    request.session._session_key
    
    0 讨论(0)
提交回复
热议问题