app.config['SQLALCHEMY_FOLLOWER_TASKS'] = [ 'webservices.tasks.download.export_query', ] app.config['SQLALCHEMY_FOLLOWERS'] = [ sa.create_engine(follower.strip()) for follower in env.get_credential('SQLA_FOLLOWERS', '').split(',') if follower.strip() ] # app.config['SQLALCHEMY_ECHO'] = True # Modify app configuration and logging level for production if not app.debug: app.logger.addHandler(logging.StreamHandler()) app.logger.setLevel(logging.INFO) db.init_app(app) cors.CORS(app) class FlaskRestParser(FlaskParser): def handle_error(self, error): message = error.messages status_code = getattr(error, 'status_code', 422) raise exceptions.ApiError(message, status_code) parser = FlaskRestParser() app.config['APISPEC_WEBARGS_PARSER'] = parser v1 = Blueprint('v1', __name__, url_prefix='/v1') api = restful.Api(v1)
app = Flask(__name__) app.debug = True app.config['SQLALCHEMY_DATABASE_URI'] = sqla_conn_string() app.config['APISPEC_FORMAT_RESPONSE'] = None app.config['SQLALCHEMY_REPLICA_TASKS'] = [ 'webservices.tasks.download.export_query', ] app.config['SQLALCHEMY_FOLLOWERS'] = [ sa.create_engine(follower.strip()) for follower in env.get_credential('SQLA_FOLLOWERS', '').split(',') if follower.strip() ] # app.config['SQLALCHEMY_ECHO'] = True db.init_app(app) cors.CORS(app) class FlaskRestParser(FlaskParser): def handle_error(self, error): message = error.messages status_code = getattr(error, 'status_code', 422) raise exceptions.ApiError(message, status_code) parser = FlaskRestParser() app.config['APISPEC_WEBARGS_PARSER'] = parser v1 = Blueprint('v1', __name__, url_prefix='/v1') api = restful.Api(v1)