Monday, September 24, 2012

How Django Sessions work - diagrams


How Django Sessions work - diagrams
http://eli.thegreenplace.net/2011/06/29/django-sessions-part-ii-how-sessions-work/



https://docs.djangoproject.com/en/1.4/topics/http/sessions/

Clearing the session table

If you're using the database backend, note that session data can accumulate in the django_session database table and Django does not provide automatic purging. Therefore, it's your job to purge expired sessions on a regular basis.
To understand this problem, consider what happens when a user uses a session. When a user logs in, Django adds a row to the django_session database table. Django updates this row each time the session data changes. If the user logs out manually, Django deletes the row. But if the user does not log out, the row never gets deleted.
Django provides a sample clean-up script: django-admin.py cleanup. That script deletes any session in the session table whose expire_date is in the past -- but your application may have different requirements.




No comments:

Post a Comment