Do sessions in Django expire without a request?

本秂侑毒 提交于 2020-01-16 10:38:07

问题


This answer suggests that it's possible to attach to "on session end" event in Django. However, this event seems to be called only when Django deletes the session from the database (please, correct me if I'm wrong). Does this happen only upon a request from the browser that has this session's cookie, or is there a background thread in Django that deletes sessions from the DB when they expire and calls "on sessssion end" event (more precisely, issues pre_delete signal)?

Some context: I'm writing an application that allocates some resources when the session is created. And I need to deallocate these resources when the session expires.

来源:https://stackoverflow.com/questions/54170116/do-sessions-in-django-expire-without-a-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!