From 530f18142cf1d7aae3d95ccbfbe3e1372b8f6643 Mon Sep 17 00:00:00 2001 From: Dale O'Brien Date: Mon, 26 Mar 2012 09:37:23 +1100 Subject: [PATCH] django 1.4 no longer has DATABASE_ENGINE setting, using DATABASE['default']['ENGINE'] instead, if former is not found --- dbtemplates/loader.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dbtemplates/loader.py b/dbtemplates/loader.py index 24e5010..634528d 100644 --- a/dbtemplates/loader.py +++ b/dbtemplates/loader.py @@ -33,8 +33,15 @@ class Loader(BaseLoader): # in the cache indicating that queries failed, with the current # timestamp. site = Site.objects.get_current() - display_name = 'dbtemplates:%s:%s:%s' % (settings.DATABASE_ENGINE, - template_name, site.domain) + + if 'DATABASE_ENGINE' in dir(settings): + # DATABASE_ENGINE is in django 1.1, but has been deprecated in Django 1.2 + display_name = 'dbtemplates:%s:%s:%s' % (settings.DATABASE_ENGINE, + template_name, site.domain) + else: + display_name = 'dbtemplates:%s:%s:%s' % (settings.DATABASES['default']['ENGINE'], + template_name, site.domain) + cache_key = get_cache_key(template_name) if cache: try: