Exemplo n.º 1
0
def create_app(run_mode=os.getenv('FLASK_ENV', 'production')):
    """Create app."""
    app = Flask(__name__)
    app.config.from_object(config.CONFIGURATION[run_mode])

    # Configure Sentry
    if app.config.get('SENTRY_DSN', None):
        sentry_sdk.init(dsn=app.config.get('SENTRY_DSN'),
                        integrations=[FlaskIntegration()])

    db.init_app(app)
    ma.init_app(app)

    api.init_app(app)
    setup_jwt_manager(app, jwt)

    nro.init_app(app)

    @app.after_request
    def add_version(response):
        os.getenv('OPENSHIFT_BUILD_COMMIT', '')
        response.headers['API'] = 'NameX/{ver}'.format(ver=run_version)
        return response

    register_shellcontext(app)

    return app
Exemplo n.º 2
0
def create_app(run_mode=os.getenv('FLASK_ENV', 'production')):
    """Create app."""
    app = Flask(__name__)
    app.config.from_object(config.CONFIGURATION[run_mode])

    queue.init_app(app)

    db.init_app(app)
    ma.init_app(app)

    api.init_app(app)
    setup_jwt_manager(app, jwt)

    nro.init_app(app)
    cache.init_app(app)
    nr_filing_actions.init_app(app)

    @app.after_request
    def add_version(response):
        os.getenv('OPENSHIFT_BUILD_COMMIT', '')
        response.headers['API'] = 'NameX/{ver}'.format(ver=run_version)
        return response

    register_shellcontext(app)

    return app
Exemplo n.º 3
0
def create_app(run_mode=os.getenv('FLASK_ENV', 'production')):

    app = Flask(__name__)
    app.config.from_object(config.CONFIGURATION[run_mode])

    db.init_app(app)
    ma.init_app(app)

    api.init_app(app)
    # oidc.init_app(app)
    setup_jwt_manager(app, jwt)

    register_shellcontext(app)

    return app