1 2 3 4 | from django.template.loader import render_to_string
def render_to_file(template, filename, context):
open(filename, "w").write(render_to_string(template, context))
|
1 2 3 4 | from django.template.loader import render_to_string
def render_to_file(template, filename, context):
open(filename, "w").write(render_to_string(template, context))
|
Comments
indeed, very useful!
#
Yeah, useful while living in fantASCII land: then you realize you need codecs.open instead. ;-)
#