def add_handlers(web_app, config):
    """Add the appropriate handlers to the web app.
    """
    base_url = web_app.settings['base_url']
    url = ujoin(base_url, config.page_url)
    assets_dir = config.assets_dir

    package_file = os.path.join(assets_dir, 'package.json')
    with open(package_file) as fid:
        data = json.load(fid)

    config.version = config.version or data['version']
    config.name = config.name or data['name']

    handlers = [
        # TODO Redirect to /tree
        (url + r'/?', NAppHandler, {'config': config, 'page': 'tree'}),
        (url + r"/tree%s" % path_regex, NAppHandler, {'config': config, 'page': 'tree'}),
        (url + r"/edit%s" % path_regex, NAppHandler, {'config': config, 'page': 'edit'}),
        (url + r"/view%s" % path_regex, NAppHandler, {'config': config, 'page': 'view'}),
        (url + r"/static/(.*)", FileFindHandler, {'path': assets_dir}),
    ]

    web_app.add_handlers(".*$", handlers)
Add the appropriate handlers to the web app.