Rob,

You could use a middleware to do this, which runs before every view.
Try and get a connection in there, and if it can't then forward to the
'no database' template.

http://www.djangoproject.com/documentation/middleware/

The disadvantage is that you incur an extra SQL query for every
request. If you need this because your database is unreliable I'd say
you need to fix your database. If it's so you can do planned
maintenance on it, I would still use the middleware, but check a
settings variable instead, something like MAINTENANCE_MODE, which you
change as needed. Then there is no database query.

Regards,
Graham.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to