python 散景 2.0.0 不渲染

python bokeh 2.0.0 does not render

我最近将散景从 1.4 更新到 2.0.0。我有一个带有多个散景服务器的烧瓶应用程序。更新后,散景服务器不再正确渲染(无图,空白),浏览器控制台或 redhat shell 中没有错误。如果我恢复到 bokeh 1.4 + tornado 4.5.3,它会正常呈现。有人可以帮我弄清楚发生了什么吗?

Python 3.6.3 散景 2.0.0 龙卷风 6.0.4 红帽 4.8.5

编辑:为每个 bokeh 服务器单独执行 bokeh serve myapp.py 令人惊讶的是,这一定是我通过 flask 部署它们的方式..下面的代码适用于 bokeh1.4 + tornado 4.5.3

# cycle through bokeh files and start bokeh servers
files = []
boks = []
for file in os.listdir("/mypath_to_bokeh/bokehs/"):
    if file.endswith('.py'):
        boks.append(file)
        file = "bokehs/" + file
        files.append(file)
boks = [os.path.splitext(x)[0] for x in boks]

argvs = {}
urls = []
for i in files:
    argvs[i] = None
    urls.append(i.split('\')[-1].split('.')[0])
host = 'myhost'

apps = build_single_handler_applications(files, argvs)

bokeh_tornado = BokehTornado(apps, extra_websocket_origins=["hoststring"]) 
bokeh_http = HTTPServer(bokeh_tornado)                    
sockets, port = bind_sockets("ipstring", 0) 
bokeh_http.add_sockets(sockets)

def serve(name):
    @app.route("/{}".format(name), endpoint=str(name))
    #@login_required
    #@bokeh_access
    def func():
        bokeh_script = server_document("ipstring:%d/%s" % (port, name)) 
        gc.collect()
        return render_template("bokserv.html", bokeh_script=bokeh_script)

    func.__name__ = name
    gc.collect()
    return func

all_serve_functions = [serve(name) for name in boks]

我不小心从发布的代码中遗漏了我在申请结束时拥有的东西:

def bk_worker():
    asyncio.set_event_loop(asyncio.new_event_loop())
    bokeh_tornado = BokehTornado(apps, extra_websocket_origins=["localhost:8000"]) 
    bokeh_http = HTTPServer(bokeh_tornado)                     
    sockets, port = bind_sockets("localhost", 0) #PROBLEM LINE
    bokeh_http.add_sockets(sockets)
    server = BaseServer(IOLoop.current(), bokeh_tornado, bokeh_http)
    server.start()
    server.io_loop.start()

t = Thread(target=bk_worker)
t.daemon = True
t.start()

提取出 #PROBLEM LINE 并将其放在 bk_worker() 函数之前返回的大部分散景功能,现在是时候重构所有已弃用的代码了。