| | 220 | Clearing the session table |
|---|
| | 221 | ========================== |
|---|
| | 222 | |
|---|
| | 223 | Note that session data can accumulate in the ``django_session`` database table |
|---|
| | 224 | and Django does *not* provide automatic purging. Therefore, it's your job to |
|---|
| | 225 | purge expired sessions on a regular basis. |
|---|
| | 226 | |
|---|
| | 227 | To understand this problem, consider what happens when a user uses a session. |
|---|
| | 228 | When a user logs in, Django adds a row to the ``django_session`` database |
|---|
| | 229 | table. Django updates this row each time the session data changes. If the user |
|---|
| | 230 | logs out manually, Django deletes the row. But if the user does *not* log out, |
|---|
| | 231 | the row never gets deleted. |
|---|
| | 232 | |
|---|
| | 233 | Django provides a sample clean-up script in ``django/bin/daily_cleanup.py``. |
|---|
| | 234 | That script deletes any session in the session table whose ``expire_date`` is |
|---|
| | 235 | in the past -- but your application may have different requirements. |
|---|
| | 236 | |
|---|