Search code examples
pythondjangodjango-flatpages

Urls with ".html" suffix in FlatPages


I FlatPages to display pages with .html suffix. When I try to create page with url like /about/policy.html I get error URL is missing a trailing slash. So, how can I make FlatPages use any url suffix I want?

Now I have FlatPages middleware in my MiddleWare classes installed:

MIDDLEWARE_CLASSES = (
    ...,
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

, so I don't have any url patterns related to flatpages in my urls.py.


Solution

  • I've just removed FlatPages middleware from settings and added this line to the end of my urlpatterns:

    url(r'^(?P<url>.*)', 'django.contrib.flatpages.views.flatpage'),