从散景应用程序中导航到散景服务器上托管的新页面

时间:2016-01-27 19:31:31

标签: python python-3.4 bokeh

因此,我正在编写在散景服务器上运行的应用程序,并且难以在托管的不同页面之间导航。让我们说我有这个简单的类加载一个按钮:

class navigateWithButton(HBox):

    extra_generated_classes = [["navigateWithButton", "navigateWithButton", "HBox"]]
    myButton= Instance(Button)
    inputs = Instance(VBoxForm)

    @classmethod
    def create(cls):
        obj = cls()

        obj.myButton = Button(
            label="Go"
        )

        obj.inputs = VBoxForm(
            children=[
                obj.login_button
            ]
        )

        obj.children.append(obj.inputs)
        return obj



    def setup_events(self):
        super(navigateWithButton, self).setup_events()
        if not self.myButton:
            return
        self.myButton.on_click(self.navigate)

    def navigate(self, *args):
        ###################################################################
        ### want to redirect to 'http://localhost:5006/other_app' here! ###
        ###################################################################

进一步向下,我的预期如下:

@bokeh_app.route("/navigate/")
@object_page("navigate")
def navigate_button_test():
    nav = navigateWithButton.create()
    return nav

除了我在同一个脚本中创建的addtional应用程序的路径之外:

@bokeh_app.route("/other_app/")
@object_page("other_app")
def some_other_app():
    app = otherApp.create()
    return app

运行此代码我可以(显然)只需输入地址就可以轻松地在两个应用程序之间导航,它们都可以很好地工作,但我不能在我的生活中找到一个以编程方式在两个页面之间导航的示例。我确定答案很简单,我必须忽略一些非常明显的事情,但是如果有人能够准确地告诉我我在哪里荒谬,或者我是在咆哮等待错误的树,那我就是非常感激!!

请记住:我确定有更好的方法可以做到这一点,但我的任务是完成继承的代码,我想在尝试找到解决方案之前从头开始重建

0 个答案:

没有答案