Spaces:
Running
Running
File size: 394 Bytes
947c08e |
1 2 3 4 5 6 7 8 9 10 11 12 |
from django.core.management.base import BaseCommand
from django.contrib.sessions.models import Session
from django.db import connections
class Command(BaseCommand):
help = 'Clear all sessions'
def handle(self, *args, **options):
for db in connections.databases:
Session.objects.using(db).all().delete()
self.stdout.write('All sessions have been cleared.')
|