app.py 438 B

1234567891011121314151617181920212223
  1. """
  2. Serve static content
  3. """
  4. from flask import render_template, Blueprint, abort
  5. from jinja2 import TemplateNotFound
  6. BLUEPRINT = Blueprint(
  7. "static",
  8. __name__,
  9. template_folder='pages'
  10. )
  11. @BLUEPRINT.route("/", defaults={"page": "index"})
  12. @BLUEPRINT.route("/<path:page>")
  13. def show(page):
  14. """Display static page"""
  15. try:
  16. return render_template("%s.html" % page)
  17. except TemplateNotFound:
  18. abort(404)