mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 02: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.
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
from django.core.management.base import BaseCommand
|
|
from allauth.socialaccount.models import SocialApp
|
|
from django.contrib.sites.models import Site
|
|
from django.db import connection
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = "Reset social apps configuration"
|
|
|
|
def handle(self, *args, **options):
|
|
# Delete all social apps using raw SQL to bypass Django's ORM
|
|
with connection.cursor() as cursor:
|
|
cursor.execute("DELETE FROM socialaccount_socialapp_sites")
|
|
cursor.execute("DELETE FROM socialaccount_socialapp")
|
|
|
|
# Get the default site
|
|
site = Site.objects.get(id=1)
|
|
|
|
# Create Discord app
|
|
discord_app = SocialApp.objects.create(
|
|
provider="discord",
|
|
name="Discord",
|
|
client_id="1299112802274902047",
|
|
secret="ece7Pe_M4mD4mYzAgcINjTEKL_3ftL11",
|
|
)
|
|
discord_app.sites.add(site)
|
|
self.stdout.write(f"Created Discord app with ID: {discord_app.pk}")
|
|
|
|
# Create Google app
|
|
google_app = SocialApp.objects.create(
|
|
provider="google",
|
|
name="Google",
|
|
client_id=(
|
|
"135166769591-nopcgmo0fkqfqfs9qe783a137mtmcrt2.apps.googleusercontent.com"
|
|
),
|
|
secret="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",
|
|
)
|
|
google_app.sites.add(site)
|
|
self.stdout.write(f"Created Google app with ID: {google_app.pk}")
|