from django.core.management.base import BaseCommand from django.db import connection class Command(BaseCommand): help = 'Reset social auth configuration' def handle(self, *args, **options): with connection.cursor() as cursor: # Delete all social apps cursor.execute("DELETE FROM socialaccount_socialapp") cursor.execute("DELETE FROM socialaccount_socialapp_sites") # Reset sequences cursor.execute("DELETE FROM sqlite_sequence WHERE name='socialaccount_socialapp'") cursor.execute("DELETE FROM sqlite_sequence WHERE name='socialaccount_socialapp_sites'") self.stdout.write(self.style.SUCCESS('Successfully reset social auth configuration'))