Пример #1
0
def setup_app(pecan_config=None, extra_hooks=None):

    app_conf = get_pecan_config()

    client = rpc.get_client()

    storage_backend = storage.get_storage()

    app_hooks = [
        hooks.RPCHook(client),
        hooks.StorageHook(storage_backend),
    ]

    if CONF.auth_strategy == 'keystone':
        app_hooks.append(hooks.ContextHook())

    app = pecan.make_app(app_conf.app.root,
                         static_root=app_conf.app.static_root,
                         template_path=app_conf.app.template_path,
                         debug=CONF.api.pecan_debug,
                         force_canonical=getattr(app_conf.app,
                                                 'force_canonical', True),
                         hooks=app_hooks,
                         guess_content_type_from_ext=False)

    return app
Пример #2
0
def setup_app(pecan_config=None, extra_hooks=None):

    app_conf = get_pecan_config()

    target = messaging.Target(topic='cloudkitty', version='1.0')

    client = rpc.get_client(target)

    app_hooks = [hooks.RPCHook(client)]

    return pecan.make_app(app_conf.app.root,
                          static_root=app_conf.app.static_root,
                          template_path=app_conf.app.template_path,
                          debug=CONF.debug,
                          force_canonical=getattr(app_conf.app,
                                                  'force_canonical', True),
                          hooks=app_hooks,
                          guess_content_type_from_ext=False)