Get the sourcecode from a template name without rendering it

1
2
3
4
from django.template.loader import find_template_source

def get_template_source(template_name):
    return find_template_source(template_name)[0]

Comments

(Forgotten your password?)

You may use Markdown syntax here, but raw HTML will be removed.