main.py 819 B

1234567891011121314151617181920212223242526272829303132
  1. import logging
  2. from os import path
  3. from flask import Blueprint, jsonify, render_template
  4. from lakesuperior import release
  5. from lakesuperior.dictionaries import srv_mgd_terms as smt
  6. logger = logging.getLogger(__name__)
  7. # Blueprint for main pages. Not much here.
  8. main = Blueprint('main', __name__, template_folder='templates',
  9. static_folder='templates/static')
  10. ## GENERIC ROUTES ##
  11. @main.route('/', methods=['GET'])
  12. def index():
  13. """Homepage."""
  14. return render_template('index.html', release=release)
  15. @main.route('/info/ldp_constraints', methods=['GET'])
  16. def ldp_constraints():
  17. """ LDP term constraints. """
  18. return jsonify({
  19. 'srv_mgd_subjects': [*smt.srv_mgd_subjects],
  20. 'srv_mgd_predicates': [*smt.srv_mgd_predicates],
  21. 'srv_mgd_types': [*smt.srv_mgd_types],
  22. })