#!/usr/bin/env python """ Script to set up social authentication providers for development. Run this with: python manage.py shell < setup_social_providers.py """ from allauth.socialaccount.models import SocialApp from django.contrib.sites.models import Site # Get the current site site = Site.objects.get_current() print(f"Setting up social providers for site: {site}") # Clear existing social apps to avoid duplicates SocialApp.objects.all().delete() print("Cleared existing social apps") # Create Google social app google_app = SocialApp.objects.create( provider="google", name="Google", client_id="demo-google-client-id.apps.googleusercontent.com", secret="demo-google-client-secret", key="", # Not used for Google ) google_app.sites.add(site) print("✅ Created Google social app") # Create Discord social app discord_app = SocialApp.objects.create( provider="discord", name="Discord", client_id="demo-discord-client-id", secret="demo-discord-client-secret", key="", # Not used for Discord ) discord_app.sites.add(site) print("✅ Created Discord social app") # List all social apps print("\nConfigured social apps:") for app in SocialApp.objects.all(): print(f"- {app.name} ({app.provider}): {app.client_id}") print(f"\nTotal social apps: {SocialApp.objects.count()}")