views:

36

answers:

2

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 now flatpages uses a 404 hook, but how do you configure the default website?

+2  A: 

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 Zielinski
+4  A: 

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

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

It should catch only empty requests.

Olivier
Thx a lot, it works.. so simple.. ;)
cw