I am new to Wagtail and intended to learn by practice.
Django=3.0.5 | Wagtail=2.13.1 | Python=3.7.10
I have existing Django project with below file structure:
|- manage.py
|- static/
|- templates/
|- IoTSite/
___|- urls.py
___|- settings.py
___|- ...
I was strictly following Wagtail official guide: Integrating Wagtail into a Django project for this integration. However, after I finish the root urls.py
config,
// IoTSite/urls.py
urlpatterns = [
path('',TemplateView.as_view(template_name='homepage.html'),name='home'),
path('admin/', admin.site.urls),
path('article/',ArticleListView.as_view(template_name='TL_ArticleList.html'),name='article-list'),
path('article/<int:pk>/',ArticleDetailView.as_view(template_name='TL_ArticleDetail.html'),name='article-detail'),
path('archive/<int:year>/<int:month>/', ArticleMonthArchieveView.as_view(month_format='%m',template_name='TL_ArticleList.html'),name='archive_mmonth'),
path('cms/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
path('pages/', include(wagtail_urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
when I try to access Wagtail admin site; http://127.0.0.1/cms/
I encountered 404 not found error with below debug details.
Using the URLconf defined in IoTSite.urls, Django tried these URL patterns, in this order:
1. [name='home']
2. admin/
3. article/ [name='article-list']
4. article/<int:pk>/ [name='article-detail']
5. archive/<int:year>/<int:month>/ [name='archive_mmonth']
The current path, cms/, didn't match any of these.
Q1: Why 127.0.0.1/cms
was not matched when it was clearly configured in urls.py
? are there any required configs not mentioned in the official guide ?
Q2: Behind the scene, how Django and Wagtail interacts with each other? I did not see a Watgail
app folder within the Django project directory, it seems that Django interacts with Wagtail purely via import
command and then use wagtail's pre-built components.