No Description

__init__.py 646B

12345678910111213141516171819202122232425262728
  1. import os
  2. from flask import Flask
  3. def create_app(test_config=None):
  4. app = Flask(__name__, instance_relative_config=True)
  5. app.config.from_mapping(
  6. SECRET_KEY='dev',
  7. DATABASE=os.path.join(app.instance_path, 'upr_espera.sqlite'),
  8. )
  9. if test_config is None:
  10. app.config.from_pyfile('config.py', silent=True)
  11. else:
  12. app.config.from_mapping(test_config)
  13. try:
  14. os.makedirs(app.instance_path)
  15. except OSError:
  16. pass
  17. from . import db
  18. db.init_app(app)
  19. from . import index
  20. app.register_blueprint(index.bp)
  21. app.add_url_rule('/', endpoint='index')
  22. return app