Esempio n. 1
0
def configure_extensions(app):
    """
    Attaches and configures any needed flask extensions
    to our app.

    :param app:
    """
    db.init_app(app)
    migrate.init_app(app, db)
    principal.init_app(app)
    smtp_mail.init_app(app)
Esempio n. 2
0
def configure_extensions(app):
    """
    Attaches and configures any needed flask extensions
    to our app.

    :param app:
    """
    db.init_app(app)
    migrate.init_app(app, db)
    principal.init_app(app)
    smtp_mail.init_app(app)
Esempio n. 3
0
def configure_extensions(app):
    """
    Attaches and configures any needed flask extensions
    to our app.

    :param app:
    """
    db.init_app(app)
    migrate.init_app(app, db)
    principal.init_app(app)
    smtp_mail.init_app(app)
    metrics.init_app(app)
    sentry.init_app(app)

    if app.config['CORS']:
        app.config['CORS_HEADERS'] = 'Content-Type'
        cors.init_app(app, resources=r'/api/*', headers='Content-Type', origin='*', supports_credentials=True)
Esempio n. 4
0
def configure_extensions(app):
    """
    Attaches and configures any needed flask extensions
    to our app.

    :param app:
    """
    db.init_app(app)
    migrate.init_app(app, db)
    principal.init_app(app)
    smtp_mail.init_app(app)
    metrics.init_app(app)
    sentry.init_app(app)

    if app.config['CORS']:
        app.config['CORS_HEADERS'] = 'Content-Type'
        cors.init_app(app, resources=r'/api/*', headers='Content-Type', origin='*', supports_credentials=True)
Esempio n. 5
0
def configure_extensions(app):
    """
    Attaches and configures any needed flask extensions
    to our app.

    :param app:
    """
    db.init_app(app)
    migrate.init_app(app, db)
    principal.init_app(app)
    smtp_mail.init_app(app)
    metrics.init_app(app)

    # the legacy Raven[flask] relied on SENTRY_CONFIG
    if app.config.get("SENTRY_DSN", None) or app.config.get(
            "SENTRY_CONFIG", None):
        # priority given to SENTRY_DSN
        sentry_dsn = app.config.get("SENTRY_DSN",
                                    None) or app.config["SENTRY_CONFIG"]['dsn']
        sentry_sdk.init(
            dsn=sentry_dsn,
            integrations=[
                SqlalchemyIntegration(),
                CeleryIntegration(),
                RedisIntegration(),
                FlaskIntegration()
            ],
            # associating users to errors
            send_default_pii=True,
            shutdown_timeout=60,
            environment=app.config.get("LEMUR_ENV", ''),
        )

    if app.config["CORS"]:
        app.config["CORS_HEADERS"] = "Content-Type"
        cors.init_app(
            app,
            resources=r"/api/*",
            headers="Content-Type",
            origin="*",
            supports_credentials=True,
        )
Esempio n. 6
0
def configure_extensions(app):
    """
    Attaches and configures any needed flask extensions
    to our app.

    :param app:
    """
    db.init_app(app)
    migrate.init_app(app, db)
    principal.init_app(app)
    smtp_mail.init_app(app)
    metrics.init_app(app)
    sentry.init_app(app)

    if app.config["CORS"]:
        app.config["CORS_HEADERS"] = "Content-Type"
        cors.init_app(
            app,
            resources=r"/api/*",
            headers="Content-Type",
            origin="*",
            supports_credentials=True,
        )