MiniGunnR
MiniGunnR

Reputation: 5800

How to show flatpages with a single URL in Django?

I am trying to namespace Flatpages in Django. I included /pages/ in URLConf and added one URL /help/ in Django Admin Sites module. However, the page is loading with '/help/' and '/pages/help/' both URLs. I am trying to stop this behaviour and only load the page with /pages/help/. How is this possible?

urlpatterns = [
    ...

    url(r'^pages/', include('django.contrib.flatpages.urls')),
]

Django Admin panel

Upvotes: 0

Views: 115

Answers (1)

solarissmoke
solarissmoke

Reputation: 31404

You must have the fallback middleware installed in your MIDDLEWARE_CLASSES setting:

'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'

Remove it, and then it will only work on the prefix you have specified.

Upvotes: 1

Related Questions