我正在尝试在Google Cloud AI笔记本环境中构建和测试一些bokeh组件。我使用这个云实例已经有几个月了,几乎没有问题,但是似乎无法使教程https://bokeh.pydata.org/en/latest/docs/user_guide/notebook.html正常运行。在此环境中,有没有人成功与bokeh服务器合作?
该教程似乎不适用于我的用例。遵循和调整此方法时,将返回一些JavaScript错误。
handler = FunctionHandler(modify_doc)
app = Application(handler)
show(modify_doc, notebook_url=remote_jupyter_proxy_url)
def remote_jupyter_proxy_url(port):
"""
Callable to configure Bokeh's show method when a proxy must be
configured.
If port is None we're asking about the URL
for the origin header.
"""
base_url = URL OF AI NOTEBOOK
host = urllib.parse.urlparse(base_url).netloc
# If port is None we're asking for the URL origin
# so return the public hostname.
if port is None:
return host
service_url_path = NOT A JUPYTER HUB SO UNCLEAR WHAT SHOULD BE HERE
proxy_url_path = 'proxy/%d' % port
user_url = urllib.parse.urljoin(base_url, service_url_path)
full_url = urllib.parse.urljoin(user_url, proxy_url_path)
print(full_url)
return full_url
将前面的代码修补在一起时,在检查笔记本时会收到以下消息:
panellayout.js:213混合的内容:“ URL”处的页面已通过HTTPS加载,但请求了不安全的脚本“ URL”。该请求已被阻止;内容必须通过HTTPS提供。