From 08e003e165d9c6e011c2c129f3a724d07a299d2e Mon Sep 17 00:00:00 2001 From: codex_a Date: Sat, 28 Feb 2026 20:40:20 +0000 Subject: [PATCH] fix: update ALL site records in seed, not just is_default_site Wagtail's initial migration creates a localhost:80 site. Wagtail matches incoming requests by hostname before ever checking is_default_site, so updating only the is_default_site record left localhost:80 still pointing at the Welcome page. Fix by updating root_page on every site. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- apps/core/management/commands/seed_e2e_content.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/core/management/commands/seed_e2e_content.py b/apps/core/management/commands/seed_e2e_content.py index 06e555f..5ee6dc6 100644 --- a/apps/core/management/commands/seed_e2e_content.py +++ b/apps/core/management/commands/seed_e2e_content.py @@ -116,17 +116,16 @@ class Command(BaseCommand): legal_index.add_child(instance=privacy) privacy.save_revision().publish() - # Update the existing default site (whatever hostname Wagtail created it with) - # rather than creating a new 127.0.0.1 entry that leaves localhost pointing - # to the Welcome page. - site = Site.objects.filter(is_default_site=True).first() + # Point every existing Site at the real home page and mark exactly one + # as the default. Wagtail's initial migration creates a localhost:80 + # site that matches incoming requests by hostname before the + # is_default_site fallback is ever reached, so we must update *all* + # sites, not just the is_default_site one. + Site.objects.all().update(root_page=home, site_name="No Hype AI", is_default_site=False) + site = Site.objects.first() if site is None: site = Site(hostname="localhost", port=80) - site.root_page = home site.is_default_site = True - site.site_name = "No Hype AI" site.save() - # Remove any other conflicting default-site entries left by test fixtures - Site.objects.exclude(pk=site.pk).filter(is_default_site=True).update(is_default_site=False) self.stdout.write(self.style.SUCCESS("Seeded E2E content.")) -- 2.49.1