My urls.py
file as below:
urlpatterns = [
path('',TemplateView.as_view(template_name='homepage.html'),name='home'),
path('admin/', admin.site.urls),
path('cms/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
path('info/', include(wagtail_urls)),
]
It is a fresh integration of Wagtail into Existing Django. So, I have only 1 SITE on wagtail admin portal which is the default one localhost:80
with ROOT PAGE
pointing to default root page Welcome to Wagtail
.
below screenshot shows that ROOT PAGE has slug = home
.
I can successfully access the root page via domain.com/info
as per the settings in urls.py
. But I got 404 Page not found
for both domain.com/info/home
and domain.com/home
. It seems to me that slug
is completely useless for ROOT Page.
Above testing makes me wondering whether slug
setting is cosmetic for ROOT PAGE ?
The purpose of slug on the root page in Wagtail is nothing. The root of a website is /
. The slug field of the root page is ignored.
The slug is automatically populated and doesn't do any harm.
In Wagtail any page in the page tree can be selected as the Site.root_page
. This can be convenient in multi-site setups. A subpage of one site might be the root_page/homepage of another site. Then the slug doesn't have a purpose in one site, but does have a purpose on another site.