16 lines
507 B
Python
16 lines
507 B
Python
# management/commands/update_site.py
|
|
from django.core.management.base import BaseCommand
|
|
from django.contrib.sites.models import Site
|
|
from django.conf import settings
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = "Update the default site domain"
|
|
|
|
def handle(self, *args, **options):
|
|
site = Site.objects.get_current()
|
|
site.domain = settings.SITE_DOMAIN
|
|
site.name = settings.SITE_NAME
|
|
site.save()
|
|
self.stdout.write(self.style.SUCCESS(f"Site updated to: {site.domain}"))
|