def make_app(): """Instantiates Flask app, attaches Storage database, installs acl.""" LOG.info('Starting API') app = flask.Flask(__name__) app.register_blueprint(v1.blueprint, url_prefix='/v1') storage = Storage() storage.refresh() @app.before_request def attach_config(): flask.request.storage = storage storage['lock'].acquire() @app.after_request def unlock(response): storage['lock'].release() return response # Install the middleware wrapper if cfg.CONF.acl_enabled: acl.install(app, cfg.CONF) return app