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

    static_root = os.path.join(PROJECT_ROOT, 'dist')

    app.add_url_rule('/static/<path:filename>',
                     view_func=StaticView.as_view(b'static', root=static_root))

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

    index_view = IndexView.as_view(b'index', login_url='login')
    app.add_url_rule('/', view_func=index_view)
    app.add_url_rule('/<path:path>', view_func=index_view)
示例#2
0
def configure_web_routes(app):
    from freight.web.auth import AuthorizedView, LoginView, LogoutView
    from freight.web.index import IndexView
    from freight.web.static import StaticView
    from freight.web.webhooks import WebhooksView

    static_root = os.path.join(PROJECT_ROOT, "dist")

    app.add_url_rule(
        "/static/<path:filename>",
        view_func=StaticView.as_view("static", root=static_root),
    )
    app.add_url_rule(
        "/webhooks/<hook>/<action>/<app>/<env>/<digest>/",
        view_func=WebhooksView.as_view("webhooks"),
    )
    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"
        ),
    )

    index_view = IndexView.as_view("index", root=static_root)
    app.add_url_rule("/", view_func=index_view)
    app.add_url_rule("/<path:path>", view_func=index_view)
示例#3
0
文件: config.py 项目: Osso/freight
def configure_web_routes(app):
    from freight.web.auth import AuthorizedView, LoginView, LogoutView
    from freight.web.index import IndexView
    from freight.web.static import StaticView

    static_root = os.path.join(PROJECT_ROOT, "dist")

    app.add_url_rule("/static/<path:filename>", view_func=StaticView.as_view(b"static", root=static_root))

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

    index_view = IndexView.as_view(b"index", login_url="login")
    app.add_url_rule("/", view_func=index_view)
    app.add_url_rule("/<path:path>", view_func=index_view)
示例#4
0
文件: config.py 项目: thoas/freight
def configure_web_routes(app):
    from freight.web.auth import AuthorizedView, LoginView, LogoutView
    from freight.web.index import IndexView
    from freight.web.static import StaticView

    static_root = os.path.join(PROJECT_ROOT, 'dist')

    app.add_url_rule(
        '/static/<path:filename>',
        view_func=StaticView.as_view(b'static', root=static_root))

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

    index_view = IndexView.as_view(b'index', login_url='login')
    app.add_url_rule('/', view_func=index_view)
    app.add_url_rule('/<path:path>', view_func=index_view)