I am trying to set up django flat pages that would be accessible via a url like /pages/page1.html
instead of /pages/page1
.
Followed the flatpages docs, and instead of the flatpages middleware used this code in the root urls.py
(in the same folder with settings.py
):
re_path('pages/.*\.html$', include('django.contrib.flatpages.urls')),
But this results in a 404 error.
I tried specifying the extension as a non-capturing group:
re_path('pages/.*(?:\.html)$', include('django.contrib.flatpages.urls')),
but I'm still getting a 404.
What would be the correct way to have the .html
suffix for flatpages?