views:

22

answers:

1

Is there any that I can have a catch all site with flatpage framework in Django?

I have one site but you can get to it through a few DNS names that change constantly. I need to map these all to a single site and flatpages seems bent on me pre-specifying my domain entries.

+1  A: 

You need to configure your webserver correctly so that the requests from all domains get forwarded to your only django instance! You cannot run flatpages without having django.contrib.sites in your INSTALLED_APPS, but that is no problem for your case, the actual site will always be determined with the SITE_ID defined in your settings.py. The sites framework does not check the request to check which is the actual site. If you run multiple sites, you have to run multiple django instances that use different settings, which define different SITE_IDs! So just check your webserver to have everything directed to your django instance!

lazerscience
The issue I was actually having is that the domain is used to reconstruct urls in admin to preview the site. I didn't realize the site ID didn't matter. I patched flatpages in django to fix this by allowing their sites model to allow a blank domain entry and allow editing of site ids in the admin. Sites table is not a feature that should be editable by admin interface to me because it can break dependent code on specific IDs. Oh well.
Zac Bowling
Instead of patching the original django code you could maybe also have done your own flatpage app with subclassing the original one's models, admin etc... I'm also thinking that "normal" users (staff) shouldn't have access to the sites app, so I recommend to not give them permissions to touch the sites!
lazerscience