如何在Bokeh服务器中设置Auth模块

2024-05-19 02:53:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在运行一个Bokeh应用程序,如standalone_embed.py所示,并希望使用一个身份验证挂钩,如here所示。如何在{}中的{}中设置{}

我试过了

from bokeh.settings import settings

settings.auth_module = "auth.py"
settings.xsrf_cookies = True

但这似乎没有任何作用。感谢您的帮助,谢谢


Tags: frompyimportauth身份验证应用程序heresettings
1条回答
网友
1楼 · 发布于 2024-05-19 02:53:41

找到了答案:

Server可以将身份验证模块作为参数,如下所示:

auth_module_path = <path to auth.py>
if auth_module_path:
    server_kwargs['auth_provider'] = AuthModule(auth_module_path)

server = Server(
    bokeh_applications,  # list of Bokeh applications
    io_loop=loop,        # Tornado IOLoop
    **server_kwargs      # port, num_procs, etc.
)

相关问题 更多 >

    热门问题