def setup_app(root, conf=None): app_hooks = [hooks.ConfigHook(conf), hooks.TranslationHook(), hooks.RPCHook(conf), hooks.ContextHook(), hooks.DBHook(conf)] app = pecan.make_app( root, hooks=app_hooks, guess_content_type_from_ext=False ) return app
def setup_app(pecan_config=PECAN_CONFIG, conf=None): if conf is None: raise RuntimeError('Config is actually mandatory') app_hooks = [ hooks.ConfigHook(conf), hooks.TranslationHook(), hooks.RPCHook(conf), hooks.ContextHook() ] pecan.configuration.set_config(dict(pecan_config), overwrite=True) pecan_debug = conf.api.pecan_debug if conf.api.workers != 1 and pecan_debug: pecan_debug = False LOG.warning('pecan_debug cannot be enabled, if workers is > 1, ' 'the value is overridden with False') app = pecan.make_app(pecan_config['app']['root'], debug=pecan_debug, hooks=app_hooks, guess_content_type_from_ext=False) return app