from django.template.loader import render_to_string

def render_to_file(template, filename, context):
    open(filename, "w").write(render_to_string(template, context))