from django.contrib.sites.models import Site


def set_site_info(domain='datahub-local.mit.edu', name='MIT DataHub'):
    site = Site.objects.get_current()
    if site.domain != domain:
        site.domain = domain
        site.name = name
        site.save()

from django.contrib.sites.models import Site
from django.db.utils import ProgrammingError


def set_site_info(domain='datahub-local.mit.edu', name='MIT DataHub'):
    try:
        site = Site.objects.get_current()
        if site.domain != domain:
            site.domain = domain
            site.name = name
            site.save()
    except ProgrammingError:
        pass

Make sure initial migration works for new installs.
Make sure initial migration works for new installs.

Bootstrapping the Site model entirely in settings isn't great.
