main.py 719 B

123456789101112131415161718192021222324252627282930313233
  1. import logging
  2. from os import path
  3. from flask import Blueprint, render_template
  4. from lakesuperior import basedir
  5. logger = logging.getLogger(__name__)
  6. # Blueprint for main pages. Not much here.
  7. main = Blueprint('main', __name__, template_folder='templates',
  8. static_folder='templates/static')
  9. ## GENERIC ROUTES ##
  10. @main.route('/', methods=['GET'])
  11. def index():
  12. """Homepage."""
  13. version_fname = path.abspath(
  14. path.join(path.dirname(basedir), 'VERSION'))
  15. with open(version_fname) as fh:
  16. version = fh.readlines()[0]
  17. return render_template('index.html', version=version)
  18. @main.route('/debug', methods=['GET'])
  19. def debug():
  20. """Debug page."""
  21. raise RuntimeError()