app.py 585 B

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