mirror of
https://github.com/thecyberlearn/modern-django-starter.git
synced 2026-08-18 08:52:55 +00:00
- Add social account auto-signup settings to prevent password reset emails - Change default site name from 'Django Template' to 'App' for cleaner email subjects - Enable automatic account linking for Google OAuth users 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
from django.core.management.base import BaseCommand
|
|
from django.contrib.sites.models import Site
|
|
from django.conf import settings
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = 'Configure Django Site for production domain'
|
|
|
|
def add_arguments(self, parser):
|
|
parser.add_argument(
|
|
'--domain',
|
|
type=str,
|
|
default='dt.netcoptech.com',
|
|
help='Domain name for the site',
|
|
)
|
|
parser.add_argument(
|
|
'--name',
|
|
type=str,
|
|
default='App',
|
|
help='Display name for the site',
|
|
)
|
|
|
|
def handle(self, *args, **options):
|
|
domain = options['domain']
|
|
name = options['name']
|
|
|
|
# Get or create the default site (pk=1)
|
|
site, created = Site.objects.get_or_create(pk=1)
|
|
site.domain = domain
|
|
site.name = name
|
|
site.save()
|
|
|
|
if created:
|
|
self.stdout.write(
|
|
self.style.SUCCESS(f'✅ Created new site: {name} ({domain})')
|
|
)
|
|
else:
|
|
self.stdout.write(
|
|
self.style.SUCCESS(f'✅ Updated existing site: {name} ({domain})')
|
|
)
|
|
|
|
self.stdout.write(
|
|
self.style.SUCCESS('Site configuration completed successfully!')
|
|
)
|