diff --git a/django/contrib/sites/management.py b/django/contrib/sites/management.py index 7a29e82d4cdf..ed336353023b 100644 --- a/django/contrib/sites/management.py +++ b/django/contrib/sites/management.py @@ -5,6 +5,7 @@ from django.db.models import signals from django.db import connections from django.db import router +from django.conf import settings from django.contrib.sites.models import Site from django.contrib.sites import models as site_app from django.core.management.color import no_style @@ -19,7 +20,7 @@ def create_default_site(app, created_models, verbosity, db, **kwargs): # can also crop up outside of tests - see #15346. if verbosity >= 2: print("Creating example.com Site object") - Site(pk=1, domain="example.com", name="example.com").save(using=db) + Site(pk=settings.SITE_ID, domain="example.com", name="example.com").save(using=db) # We set an explicit pk instead of relying on auto-incrementation, # so we need to reset the database sequence. See #17415.