Example #1
0
def configure_web_routes(app):
    from changes.web.auth import AuthorizedView, LoginView, LogoutView
    from changes.web.index import IndexView
    from changes.web.static import StaticView

    if app.debug:
        static_root = os.path.join(PROJECT_ROOT, 'static')
        revision = '0'
    else:
        static_root = os.path.join(PROJECT_ROOT, 'static-built')
        revision = changes.get_revision() or '0'

    app.add_url_rule('/static/' + revision + '/<path:filename>',
                     view_func=StaticView.as_view('static', root=static_root))
    app.add_url_rule('/partials/<path:filename>',
                     view_func=StaticView.as_view('partials',
                                                  root=os.path.join(
                                                      PROJECT_ROOT,
                                                      'partials')))

    app.add_url_rule('/auth/login/',
                     view_func=LoginView.as_view('login',
                                                 authorized_url='authorized'))
    app.add_url_rule('/auth/logout/',
                     view_func=LogoutView.as_view('logout',
                                                  complete_url='index'))
    app.add_url_rule('/auth/complete/',
                     view_func=AuthorizedView.as_view(
                         'authorized',
                         authorized_url='authorized',
                         complete_url='index'))

    app.add_url_rule('/<path:path>', view_func=IndexView.as_view('index-path'))
    app.add_url_rule('/', view_func=IndexView.as_view('index'))
Example #2
0
def configure_web_routes(app):
    from changes.web.auth import AuthorizedView, LoginView, LogoutView
    from changes.web.index import IndexView
    from changes.web.static import StaticView

    if app.debug:
        static_root = os.path.join(PROJECT_ROOT, 'static')
        revision = '0'
    else:
        static_root = os.path.join(PROJECT_ROOT, 'static-built')
        revision = changes.get_revision() or '0'

    app.add_url_rule(
        '/static/' + revision + '/<path:filename>',
        view_func=StaticView.as_view('static', root=static_root))
    app.add_url_rule(
        '/partials/<path:filename>',
        view_func=StaticView.as_view('partials', root=os.path.join(PROJECT_ROOT, 'partials')))

    app.add_url_rule(
        '/auth/login/', view_func=LoginView.as_view('login', authorized_url='authorized'))
    app.add_url_rule(
        '/auth/logout/', view_func=LogoutView.as_view('logout', complete_url='index'))
    app.add_url_rule(
        '/auth/complete/', view_func=AuthorizedView.as_view('authorized', authorized_url='authorized', complete_url='index'))

    app.add_url_rule(
        '/<path:path>', view_func=IndexView.as_view('index-path'))
    app.add_url_rule(
        '/', view_func=IndexView.as_view('index'))
Example #3
0
def configure_web_routes(app):
    from changes.web.auth import AuthorizedView, LoginView, LogoutView

    # the path used by the webapp for static resources uses the current app
    # version (which is a git hash) so that browsers don't use an old, cached
    # versions of those resources

    if app.debug:
        static_root = os.path.join(PROJECT_ROOT, 'static')
        revision = '0'
    else:
        static_root = os.path.join(PROJECT_ROOT, 'static-built')
        revision_facts = changes.get_revision_info() or {}
        revision = revision_facts.get('hash', '0')

    app.add_url_rule(
        '/auth/login/', view_func=LoginView.as_view('login', authorized_url='authorized'))
    app.add_url_rule(
        '/auth/logout/', view_func=LogoutView.as_view('logout', complete_url='index'))
    app.add_url_rule(
        '/auth/complete/', view_func=AuthorizedView.as_view('authorized',
                                                            complete_url='index',
                                                            authorized_url='authorized',
                                                            ))

    configure_default(app)
Example #4
0
def configure_web_routes(app):
    from changes.web.auth import AuthorizedView, LoginView, LogoutView

    # the path used by the webapp for static resources uses the current app
    # version (which is a git hash) so that browsers don't use an old, cached
    # versions of those resources

    if app.debug:
        static_root = os.path.join(PROJECT_ROOT, 'static')
        revision = '0'
    else:
        static_root = os.path.join(PROJECT_ROOT, 'static-built')
        revision_facts = changes.get_revision_info() or {}
        revision = revision_facts.get('hash', '0')

    app.add_url_rule('/auth/login/',
                     view_func=LoginView.as_view('login',
                                                 authorized_url='authorized'))
    app.add_url_rule('/auth/logout/',
                     view_func=LogoutView.as_view('logout',
                                                  complete_url='index'))
    app.add_url_rule('/auth/complete/',
                     view_func=AuthorizedView.as_view(
                         'authorized',
                         complete_url='index',
                         authorized_url='authorized',
                     ))

    configure_default(app)
Example #5
0
def configure_web_routes(app):
    from changes.web.auth import AuthorizedView, LoginView, LogoutView
    from changes.web.index import IndexView
    from changes.web.static import StaticView

    # the path used by the webapp for static resources uses the current app
    # version (which is a git hash) so that browsers don't use an old, cached
    # versions of those resources

    if app.debug:
        static_root = os.path.join(PROJECT_ROOT, 'static')
        revision = '0'
    else:
        static_root = os.path.join(PROJECT_ROOT, 'static-built')
        revision_facts = changes.get_revision_info() or {}
        revision = revision_facts.get('hash', '0')

    app.add_url_rule('/static/' + revision + '/<path:filename>',
                     view_func=StaticView.as_view('static', root=static_root))
    app.add_url_rule('/partials/<path:filename>',
                     view_func=StaticView.as_view('partials',
                                                  root=os.path.join(
                                                      PROJECT_ROOT,
                                                      'partials')))

    app.add_url_rule('/auth/login/',
                     view_func=LoginView.as_view('login',
                                                 authorized_url='authorized'))
    app.add_url_rule('/auth/logout/',
                     view_func=LogoutView.as_view('logout',
                                                  complete_url='index'))
    app.add_url_rule('/auth/complete/',
                     view_func=AuthorizedView.as_view(
                         'authorized',
                         complete_url='index',
                         authorized_url='authorized',
                     ))

    app.add_url_rule('/<path:path>', view_func=IndexView.as_view('index-path'))
    app.add_url_rule('/', view_func=IndexView.as_view('index'))

    # bit of a hack: we use this for creating the v2 blueprint
    return static_root
Example #6
0
def configure_web_routes(app):
    from changes.web.auth import AuthorizedView, LoginView, LogoutView
    from changes.web.index import IndexView
    from changes.web.static import StaticView

    # the path used by the webapp for static resources uses the current app
    # version (which is a git hash) so that browsers don't use an old, cached
    # versions of those resources

    if app.debug:
        static_root = os.path.join(PROJECT_ROOT, 'static')
        revision = '0'
    else:
        static_root = os.path.join(PROJECT_ROOT, 'static-built')
        revision_facts = changes.get_revision_info() or {}
        revision = revision_facts.get('hash', '0')

    app.add_url_rule(
        '/static/' + revision + '/<path:filename>',
        view_func=StaticView.as_view('static', root=static_root))
    app.add_url_rule(
        '/partials/<path:filename>',
        view_func=StaticView.as_view('partials', root=os.path.join(PROJECT_ROOT, 'partials')))

    app.add_url_rule(
        '/auth/login/', view_func=LoginView.as_view('login', authorized_url='authorized'))
    app.add_url_rule(
        '/auth/logout/', view_func=LogoutView.as_view('logout', complete_url='index'))
    app.add_url_rule(
        '/auth/complete/', view_func=AuthorizedView.as_view('authorized',
                                                            complete_url='index',
                                                            authorized_url='authorized',
                                                            ))

    app.add_url_rule(
        '/<path:path>', view_func=IndexView.as_view('index-path'))
    app.add_url_rule(
        '/', view_func=IndexView.as_view('index'))

    # bit of a hack: we use this for creating the v2 blueprint
    return static_root