Skip to main content
 首页 » 编程设计

python之Bokeh 服务器白名单

2024年10月17日7over140

如何使用我的白名单地址文件启动 Bokeh 服务器?

我目前使用

启动它
python -m bokeh server --host x.x.x.x:5006 --host x.x.x.x:5006 --host x.x.x.x:5006 --host x.x.x.x:5006 --host x.x.x.x:5006 --host x.x.x.x:5006 --show myapp 

我愿意这样

python -m bokeh server --host whitelist.txt --show myapp 

请您参考如下方法:

我猜这个功能在 bokeh 命令行中仍然没有实现。不过可以使用一些 bash 语言。假设您在文件“whitelist.txt”中的几行中有地址和服务器名称列表,例如

some.servername.com 
xxx.xxx.xxx.xxx 
some.other.server.com 
yyy.yyy.yyy.yyy 
... 

然后你可以启动你的 Bokeh 服务器:

cmd="bokeh serve myapp.py --port XXXX --prefix someprefix";while read line;do cmd+=" --host $line:80"; done <whitelist.txt;eval $cmd 

然后您就可以在浏览器中访问您的应用程序了:

http://some.other.server.com/someprefix/myapp.py