1
You have configured the pages URLs with a prefix of ^pages/
, which means you need to add that prefix to your request URL. E.g., for a page that you have configured as /help/overview/
, you would access it from http://localhost:8000/pages/help/overview/
.
You either need to request all your page URLs with a /pages/
prefix, or use one of the other methods described in the documentation:
You can also set it up as a “catchall” pattern. In this case, it is important to place the pattern at the end of the other urlpatterns:
from django.contrib.flatpages import views # Your other patterns here urlpatterns += [ url(r'^(?P<url>.*/)$', views.flatpage), ]
Another common setup is to use flat pages for a limited set of known pages and to hard code the urls, so you can reference them with the url template tag:
urlpatterns += [ url(r'^about-us/$', views.flatpage, {'url': '/about-us/'}, name='about'), url(r'^license/$', views.flatpage, {'url': '/license/'}, name='license'), ]
Finally you can also use the FlatPageFallbackMiddleware
.
Source:stackexchange.com