Why doesn't SESSION_EXPIRE_AT_BROWSER_CLOSE = True log the user out when the browser is closed?

前端 未结 4 1696
后悔当初
后悔当初 2020-12-25 12:40

According to Django documentation, \"if SESSION_EXPIRE_AT_BROWSER_CLOSE is set to True, Django will use browser-length cookies -- cookies that expire as soon as the user clo

4条回答
  •  春和景丽
    2020-12-25 13:42

    @istruble and @haasfsafas are both correct. The solution is to

    1. Set SESSION_EXPIRE_AT_BROWSER_CLOSE = True
    2. Delete the rows in the django_session table to clear out any sessions that might cause confusion. (delete from django_session)
    3. Recognize that all of the windows and tabs in your browser must be closed in order for the session to expire. That's browser behavior; not Django behavior.

提交回复
热议问题