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
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
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
async def create_app(run_mode): try: print('CREATING APPLICATION') quart_app = Quart(__name__) quart_app.config.from_object(config.CONFIGURATION[run_mode]) db.init_app(quart_app) ma.init_app(quart_app) except Exception as err: print('Error creating application in auto-analyze service: ' + repr(err.with_traceback(None))) raise @quart_app.after_request def add_version(response): os.getenv('OPENSHIFT_BUILD_COMMIT', '') return response register_shellcontext(quart_app) await quart_app.app_context().push() return quart_app
async def create_app(run_mode): """Create the app object for configuration and use.""" try: quart_app = Quart(__name__) quart_app.logger.debug('APPLICATION CREATED') quart_app.config.from_object(config.CONFIGURATION[run_mode]) db.init_app(quart_app) ma.init_app(quart_app) except Exception as err: quart_app.logger.debug( 'Error creating application in auto-analyze service: {0}'.format( repr(err.with_traceback(None)))) raise @quart_app.after_request def add_version(response): # pylint: disable=unused-variable; linter not understanding framework call os.getenv('OPENSHIFT_BUILD_COMMIT', '') return response register_shellcontext(quart_app) await quart_app.app_context().push() return quart_app