def install_middlewares(app, settings):
 if settings.get('newrelic_config'):
  ini_file = settings['newrelic_config']
  env = settings['newrelic_env']
  newrelic.agent.initialize(ini_file, env)
  app = newrelic.agent.WSGIApplicationWrapper(app)
 if asbool(settings.get('profiler_enabled')):
  profile_dir = settings['profiler_dir']
  app = ProfilerMiddleware(app, profile_dir=profile_dir, restrictions='*kinto.core*')
 return app

def install_middlewares ( app , settings ) : if settings . get ( 'newrelic_config' ) : ini_file = settings [ 'newrelic_config' ] env = settings [ 'newrelic_env' ] newrelic . agent . initialize ( ini_file , env ) app = newrelic . agent . WSGIApplicationWrapper ( app ) if asbool ( settings . get ( 'profiler_enabled' ) ) : profile_dir = settings [ 'profiler_dir' ] app = ProfilerMiddleware ( app , profile_dir = profile_dir , restrictions = '*kinto.core*' ) return app
install a set of middlewares defined in the ini file on the given app .