Mercurial > public > sg101
annotate tools/ssg101/ssg101.py @ 1206:02181fa5ac9d modernize tip
Update to Django 1.9.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 22 Jan 2025 17:58:16 -0600 |
parents | b9514abc2a67 |
children |
rev | line source |
---|---|
bgneal@1200 | 1 import jinja2 |
bgneal@1200 | 2 |
bgneal@1200 | 3 |
bgneal@1200 | 4 def main(): |
bgneal@1200 | 5 print('Hello World') |
bgneal@1200 | 6 |
bgneal@1200 | 7 env = jinja2.Environment( |
bgneal@1200 | 8 loader=jinja2.PackageLoader('ssg101'), |
bgneal@1200 | 9 ) |
bgneal@1200 | 10 template = env.get_template('home.html') |
bgneal@1200 | 11 |
bgneal@1200 | 12 with open('output/home.html', 'w') as fp: |
bgneal@1200 | 13 fp.write(template.render()) |
bgneal@1200 | 14 |
bgneal@1200 | 15 |
bgneal@1200 | 16 if __name__ == '__main__': |
bgneal@1200 | 17 main() |