()
Updates site domain and name.
Updates site domain and name.
Updates site domain and name .
def init_site():
    """
    Updates site domain and name.
    """
    from django.contrib.sites.models import Site

    # Print information on the database.
    db = settings.DATABASES['default']
    logger.info(f"db.name={db['NAME']}, db.engine={db['ENGINE']}")
    logger.info(f"email.backend={settings.EMAIL_BACKEND}, email.sender={settings.DEFAULT_FROM_EMAIL}")

    # Create the default site if necessary.
    Site.objects.get_or_create(id=settings.SITE_ID)

    # Update the default site domain and name.
    Site.objects.filter(id=settings.SITE_ID).update(domain=settings.SITE_DOMAIN, name=settings.SITE_NAME)

    # Get the current site
    site = Site.objects.get(id=settings.SITE_ID)
    logger.info("site.name={}, site.domain={}".format(site.name, site.domain))
def init_site ( ) : from django . contrib . sites . models import Site # Print information on the database. db = settings . DATABASES [ 'default' ] logger . info ( f"db.name={db['NAME']}, db.engine={db['ENGINE']}" ) logger . info ( f"email.backend={settings.EMAIL_BACKEND}, email.sender={settings.DEFAULT_FROM_EMAIL}" ) # Create the default site if necessary. Site . objects . get_or_create ( id = settings . SITE_ID ) # Update the default site domain and name. Site . objects . filter ( id = settings . SITE_ID ) . update ( domain = settings . SITE_DOMAIN , name = settings . SITE_NAME ) # Get the current site site = Site . objects . get ( id = settings . SITE_ID ) logger . info ( "site.name={}, site.domain={}" . format ( site . name , site . domain ) )