July 24, 2008

Django: caching parsed templates

Put this code somewhere in one of your INSTALLED_APPS __init__.py file. This code will replace the django.template.loader.get_template with cached version. Standard get_template function from django reads and parses the template code every time it's called. This version calls (if DEBUG set to False) it only once per template. After that it gets a Template object from template_cache dictionary. Link Posted by Tim at July 24, 2008 08:21 AM | TrackBack