Does this table need to be purged or is it taken care of automatically by Django?
Django does NOT provide automatic purging. There is however a handy command available to help you do it manually: Django docs: Clearing the session store
python manage.py clearsessions
python manage.py clearsessions
python manage.py cleanup
from django.contrib.sessions.models import Session
Session.objects.all().delete()
On my development server
, I prefer a database command over python manage.py clearsessions
because you delete all sessions, not just the expired ones (here: MySQL). To login into your database and do:
truncate table django_session;
BTW, session
is not a database, but a table (django_session) and an app (django.contrib.sessions
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With