#!/usr/bin/env python
# -*- coding: utf-8 -*-

from django.template import loader
from django.conf import settings


template_cache = {} 
original_get_template = loader.get_template

def cached_get_template(template_name):
    global template_cache
    
    t = template_cache.get(template_name, None)
    if not t or settings.DEBUG:
        template_cache[template_name] = t = original_get_template(template_name)
    return t
loader.get_template = cached_get_template
@@ -43,427 +43,4 @@
 -*-%0A
-%0Afrom django.template import loader%0Afrom django.conf import settings%0A%0A%0Atemplate_cache = %7B%7D %0Aoriginal_get_template = loader.get_template%0A%0Adef cached_get_template(template_name):%0A    global template_cache%0A    %0A    t = template_cache.get(template_name, None)%0A    if not t or settings.DEBUG:%0A        template_cache%5Btemplate_name%5D = t = original_get_template(template_name)%0A    return t%0Aloader.get_template = cached_get_template

remove cached template loader as it's pointless and potentially leaky