0

I'm using django 1.1 and flatpages. It works pretty well, but I didn't manage to get a catchall or default page running.

As soon as I add a entry to url.py for my startpage, the flatpages aren't displayed anymore.

(r'^', 'myproject.mysite.views.startpage'),

I know flatpages uses a 404 hook, but how do you configure the default website?

Kevin Brown-Silva
  • 40,873
  • 40
  • 203
  • 237
cw.
  • 63
  • 1
  • 4

2 Answers2

4

I believe this is what you want (with a $):

(r'^$', 'myproject.mysite.views.startpage')

It should catch only empty requests.

Olivier Verdier
  • 46,998
  • 29
  • 98
  • 90
2

This regex matches everything, so no wonder that flatpages are not working - they are only fallback, activated on 404 error. And with this regex you don't give a chance for 404 error to show.

So, what you want to do is not possible with such regex catchall and flatpages. Personally, if I want to do catch-all, I put all 'normal' URLs above it - but flatpages are not using URLs so...

Tomasz Zieliński
  • 16,136
  • 7
  • 59
  • 83