server.py 798 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from logging.config import dictConfig
  2. from flask import Flask, render_template
  3. from lakesuperior.config_parser import config
  4. from lakesuperior.endpoints.ldp import ldp
  5. from lakesuperior.endpoints.query import query
  6. fcrepo = Flask(__name__)
  7. fcrepo.config.update(config['flask'])
  8. dictConfig(config['logging'])
  9. ## Configure enpoint blueprints here. ##
  10. fcrepo.register_blueprint(ldp, url_prefix='/ldp')
  11. # Legacy endpoint. @TODO Deprecate.
  12. fcrepo.register_blueprint(ldp, url_prefix='/rest')
  13. fcrepo.register_blueprint(query, url_prefix='/query')
  14. ## ROUTES ##
  15. @fcrepo.route('/', methods=['GET'])
  16. def index():
  17. '''
  18. Homepage.
  19. '''
  20. return render_template('index.html')
  21. @fcrepo.route('/debug', methods=['GET'])
  22. def debug():
  23. '''
  24. Debug page.
  25. '''
  26. raise RuntimeError()