コード例 #1
0
def register_extensions(app):

    api.app = app
    # Overriding swaggerUI base path to serve content under a prefix
    apidoc.apidoc.static_url_path = '{}/swaggerui'.format(Config.BASE_PATH)
    api.init_app(app)

    if app.config['ELASTIC_ENABLED'] == '1':
        apm.init_app(app)
    else:
        app.logger.debug(
            'ELASTIC_ENABLED: FALSE, set ELASTIC_ENABLED=1 to enable')

    try:
        jwt.init_app(app)
    except Exception as error:
        app.logger.error("Failed to initialize JWT library: " + str(error))

    cache.init_app(app)
    db.init_app(app)

    CORS(app)
    Compress(app)

    return None
コード例 #2
0
def register_extensions(app):

    api.app = app

    # Overriding swaggerUI base path to serve content under a prefix
    apidoc.apidoc.static_url_path = '{}/swaggerui'.format(Config.BASE_PATH)

    api.init_app(app)
    if app.config['ELASTIC_ENABLED'] == '1':
        apm.init_app(app)
        logging.getLogger('elasticapm').setLevel(30)
    else:
        app.logger.info(
            'ELASTIC_ENABLED: FALSE, set ELASTIC_ENABLED=1 to enable')

    try:
        jwt.init_app(app)
    except Exception as error:
        app.logger.error("Failed to initialize JWT library: " + str(error))

    cache.init_app(app)
    db.init_app(app)
    CORS(app)

    # Set up Marshmallow
    with app.app_context():
        setup_marshmallow()
コード例 #3
0
ファイル: __init__.py プロジェクト: MaxWardle/mds
def register_extensions(app):

    api.app = app
    # Overriding swaggerUI base path to serve content under a prefix
    apidoc.apidoc.static_url_path = '{}/swaggerui'.format(Config.BASE_PATH)
    api.init_app(app)

    cache.init_app(app)
    db.init_app(app)
    jwt.init_app(app)
    apm.init_app(app) if app.config['ELASTIC_ENABLED'] == '1' else None
    sched.init_app(app)

    CORS(app)
    Compress(app)

    if app.config.get('ENVIRONMENT_NAME') in ['test', 'prod']:
        if not app.debug or os.environ.get("WERKZEUG_RUN_MAIN") == 'true':
            sched.start()
            _schedule_NRIS_jobs(app)
            # This is here to prevent this from running in production until we are confident in the permit data.
            if app.config.get('ENVIRONMENT_NAME') == 'test':
                _schedule_ETL_jobs(app)

    return None
コード例 #4
0
ファイル: __init__.py プロジェクト: w8896699/mds
def register_extensions(app):

    api.app = app
    # Overriding swaggerUI base path to serve content under a prefix
    apidoc.apidoc.static_url_path = '{}/swaggerui'.format(Config.BASE_PATH)
    api.init_app(app)

    cache.init_app(app)
    db.init_app(app)
    jwt.init_app(app)
    apm.init_app(app) if app.config['ELASTIC_ENABLED'] == '1' else None
    sched.init_app(app)

    CORS(app)
    Compress(app)

    return None
コード例 #5
0
ファイル: __init__.py プロジェクト: cryptobuks1/mds
def register_extensions(app):

    api.app = app
    # Overriding swaggerUI base path to serve content under a prefix
    apidoc.static_url_path = f'{Config.BASE_PATH}/swaggerui'
    api.init_app(app)

    if app.config['ELASTIC_ENABLED'] == '1':
        apm.init_app(app)

    cache.init_app(app)
    db.init_app(app)
    jwt.init_app(app)
    migrate.init_app(app, db)

    CORS(app)

    return None
コード例 #6
0
def register_extensions(app):

    api.app = app
    api.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    jwt.init_app(app)
    apm.init_app(app) if app.config['ELASTIC_ENABLED'] == '1' else None

    CORS(app)
    Compress(app)

    if app.config.get('ENVIRONMENT_NAME') == 'prod':
        sched.init_app(app)
        if not app.debug or os.environ.get("WERKZEUG_RUN_MAIN") == 'true':
            sched.start()
            _schedule_NRIS_jobs(app)

    return None
コード例 #7
0
ファイル: __init__.py プロジェクト: cryptobuks1/mds
def register_extensions(app):

    api.app = app
    # Overriding swaggerUI base path to serve content under a prefix
    apidoc.static_url_path = f'{Config.BASE_PATH}/swaggerui'
    api.init_app(app)

    if app.config['ELASTIC_ENABLED'] == '1':
        apm.init_app(app)

    try:
        jwt.init_app(app)
    except Exception as error:
        app.logger.error("Failed to initialize JWT library: " + str(error))

    cache.init_app(app)
    db.init_app(app)
    migrate.init_app(app, db)

    CORS(app)

    return None