. " Wagtail" LanguageRedirectionPage.
: Wagtail Docs -
:
- Language RedirectionPage (will be redirected to / ru)- Page (ru)
- Page (de)
- Page (fr)
 
 
where the created site instance at the end of the code points to the LanguageRedirectionPage instance. This is the entry point to our application.
Site.objects.all().delete()
Page.objects.filter(pk=2).delete() # Deletes Wagtail welcome page
root_page = Page.objects.filter(pk=1).get()
app_name = '[Your Project Name]'
page_slug = app_name.lower().replace(" ", "")
sub_root_page = LanguageRedirectionPage(
    title=app_name,
    draft_title=app_name,
    slug=page_slug,
    live=True,
    owner=account,
)
root_page.add_child(instance=sub_root_page)
sub_root_page.save_revision().publish()
for code,caption in dict(settings.LANGUAGES).items():
    print(code, caption)
    sub_root_page.add_child(instance=Page(
        title=caption,
        slug=code,
        live=True,
        owner=account,
    ))
Site.objects.create(
    hostname='localhost',
    port='80',
    site_name=app_name,
    root_page=sub_root_page,
    is_default_site=True,
)