Before Django 1.7, when using the Django Sites Framework one could/should define the initial data using Initial Fixtures.
myproject/fixtures/initial_
A couple of tweaks to @Jason's answer. Last tested with Django 2.2.
from django.conf import settings
from django.db import migrations
def update_site_domain(apps, schema_editor):
Site = apps.get_model("sites", "Site")
s, _ = Site.objects.get_or_create(pk=settings.SITE_ID)
s.domain = settings.HOST
s.save()
class Migration(migrations.Migration):
dependencies = [
("your_app", "last_migration_name"),
("sites", "0002_alter_domain_unique"), # highest-numbered migration for the sites framework
]
operations = [migrations.RunPython(update_site_domain)]