mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 07:11:08 -05:00
- Cleaned up and standardized assertions in ApiTestMixin for API response validation. - Updated ASGI settings to use os.environ for setting the DJANGO_SETTINGS_MODULE. - Removed unused imports and improved formatting in settings.py. - Refactored URL patterns in urls.py for better readability and organization. - Enhanced view functions in views.py for consistency and clarity. - Added .flake8 configuration for linting and style enforcement. - Introduced type stubs for django-environ to improve type checking with Pylance.
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
from django.core.management.base import BaseCommand
|
|
from allauth.socialaccount.models import SocialApp
|
|
from django.contrib.sites.models import Site
|
|
import os
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = "Fix social app configurations"
|
|
|
|
def handle(self, *args, **options):
|
|
# Delete all existing social apps
|
|
SocialApp.objects.all().delete()
|
|
self.stdout.write("Deleted all existing social apps")
|
|
|
|
# Get the default site
|
|
site = Site.objects.get(id=1)
|
|
|
|
# Create Google provider
|
|
google_app = SocialApp.objects.create(
|
|
provider="google",
|
|
name="Google",
|
|
client_id=os.getenv("GOOGLE_CLIENT_ID"),
|
|
secret=os.getenv("GOOGLE_CLIENT_SECRET"),
|
|
)
|
|
google_app.sites.add(site)
|
|
self.stdout.write(
|
|
f"Created Google app with client_id: {
|
|
google_app.client_id}"
|
|
)
|
|
|
|
# Create Discord provider
|
|
discord_app = SocialApp.objects.create(
|
|
provider="discord",
|
|
name="Discord",
|
|
client_id=os.getenv("DISCORD_CLIENT_ID"),
|
|
secret=os.getenv("DISCORD_CLIENT_SECRET"),
|
|
)
|
|
discord_app.sites.add(site)
|
|
self.stdout.write(
|
|
f"Created Discord app with client_id: {discord_app.client_id}"
|
|
)
|