app.py 786 B

1234567891011121314151617181920212223242526272829303132333435
  1. import logging
  2. import os
  3. from logging.config import dictConfig
  4. from flask import Flask
  5. from lakesuperior.endpoints.ldp import ldp
  6. from lakesuperior.endpoints.query import query
  7. # App factory.
  8. def create_app(app_conf, logging_conf):
  9. app = Flask(__name__)
  10. app.config.update(app_conf)
  11. dictConfig(logging_conf)
  12. logger = logging.getLogger(__name__)
  13. logger.info('Starting LAKEsuperior HTTP server.')
  14. ## Configure endpoint blueprints here. ##
  15. app.register_blueprint(ldp, url_prefix='/ldp', url_defaults={
  16. 'url_prefix': 'ldp'
  17. })
  18. # Legacy endpoint. @TODO Deprecate.
  19. app.register_blueprint(ldp, url_prefix='/rest', url_defaults={
  20. 'url_prefix': 'rest'
  21. })
  22. app.register_blueprint(query, url_prefix='/query')
  23. return app