Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Render JInja template as static site using Flask
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Jinja2 static site renderer using Flask
@author Tarun Bhardwaj
@license FreeBSD Licence
from flask import Flask, abort, render_template
from jinja2 import TemplateNotFound
app = Flask(__name__)
def main(path=None):
if not path:
path = 'index.html'
return render_template(path)
except TemplateNotFound:
if __name__ == "__main__":
app.debug = True

This comment has been minimized.

Copy link
Owner Author

@tarunbhardwaj tarunbhardwaj commented Jul 17, 2014

TODO: avoid loading templates abstract templates.

i.e. template name starts with '_'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment