I've seen a settings option that is used as a check in other projects for such
a situation. You can put the check in a custom middleware.
In settings.py add something like this:
# set to True to turn on maintaince page
MAINTAINANCE = True
and rewrite process_request to return the approriate response for a maintaince
page based on the setting on a true setting or return None on a false
setting, stating the site is going through maintainence or what ever message
you want to tell them.
http://docs.djangoproject.com/en/dev/topics/http/middleware/#process-request
If you want to have the middleware check the availability of the db, I'm not
exactly positive what you can check here in django.db, but possibly to check
the connection, a thumb through django.db with ipython against a sqlite3 db,
didn't show me a lot, but I also didn't go indepth into what each method is,
for those I'm not 100% on. But this check, I'm not positive how big of a
performance hit it would be or not, since this would be checked on each
request. I've normally just set the maintaince flag manually when required.
Mike
--
Big book, big bore.
-- Callimachus
If you don't mind doing things completely wrong, sure.
"My database is broken and nothing on my site works" is not "file not
found". It is and should always be "internal server error". Unless
you'd rather have the embarrassment of people thinking there's nothing
on your site to come back and see, as opposed to having them think
it's down all the time.
--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."