demo/server/cubicweb_bookstore/pviews.py
author Frank Bessou <frank.bessou@logilab.fr>
Wed, 12 Apr 2017 14:20:55 +0200
changeset 107 c16b57922fd5
parent 12 4fbcfac206b3
permissions -rw-r--r--
Change route name for application html This route name was conflicting with the root resource name provided by cubicweb-jsonschema.

from pyramid.view import view_config


@view_config(
    route_name='html_root',
    renderer='templates/index.jinja2',
)
def app_index(request):
    script_name = request.uscript_name
    script_url = request.static_url('static/react-jsonschema-ui.js')
    return {
        'script_name': script_name,
        'script_url': script_url,
    }


def includeme(config):
    config.include('pyramid_jinja2')
    config.add_static_view('static', 'static', cache_max_age=3600)
    config.add_route('html_root', '/*subpath')
    config.scan()