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))
|
More like this
- head inclusion middleware by bowdengm 3 years, 3 months ago
- Caching XHTML render_to_response by smoonen 3 years, 10 months ago
- Create PDF files using rml and django templates by mporrato 4 years, 10 months ago
- email rendered via javascript (trick spam crawlers) by rizumu 2 years, 9 months ago
- Decorate Template Tag (In-Line include and extend with local context) by rhomber 2 years, 4 months ago
Comments
indeed, very useful!
#
Yeah, useful while living in fantASCII land: then you realize you need codecs.open instead. ;-)
#