gpt4 book ai didi

python - 无法让 Bokeh 服务器在服务器上运行

转载 作者:太空宇宙 更新时间:2023-11-04 05:42:36 25 4
gpt4 key购买 nike

我无法获得 bokeh由于跨域问题,计划在已部署的服务器上工作。我已经以几种形式问过这个问题,但没有真正得到任何结果。

我总是得到错误

XMLHttpRequest cannot load http://127.0.0.1:5006/bokeh/objinfo/0257493b-cce5-450d-8036-2bc57233b1dc/bd1791f4-4d28-4faa-8c9d-a6fe5a1721c1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://my_ip_address' is therefore not allowed access. The response had HTTP status code 500.

我是在运行小程序还是试图嵌入单个图。

在这里,我试图从 Flask 中获取情节脚本查看

@perf.route('/_fetch_heatmap', methods=['POST'])
@login_required
def fetch_sd_heatmap():

document = Document()
session = Session(root_url='http://127.0.0.1:5006', configdir=current_app.config['BASE_DIRECTORY'])
session.use_doc('sd_viz')
session.load_document(document)
...
plots = VBox(hm_duration, hm_frequency)

document.add(plots)
push(session, document)

script = autoload_server(plots, session)

return jsonify({'script': script})

此脚本返回到 ajax在我的 javascript 中调用。然后将此脚本附加到相应的 <div>

这在我的开发机器上运行良好。

下面是我的nginx生产配置

server {


listen my_ip default_server;
charset utf-8;
client_max_body_size 30M;

location ~ ^/(app_config.py|.git) {
deny all;
return 404;
}

location / {
index index.html index.htm;
root /home/myuser/app_directory;
try_files $uri @app;
}

location /static {
alias /home/myuser/app_directory/webapp/static;
}


location @app {
include uwsgi_params;
uwsgi_pass unix:/home/myuser/app_directory/uwsgi.sock;
uwsgi_connect_timeout 18000;
...
}

有没有人成功制作了带有嵌入式的 flask 应用bokeh来自 bokeh 的地 block 在生产环境中运行的服务器?

最佳答案

您好,只是为了更新这个讨论,自 0.11 中的新 Bokeh 服务器开始,有更多关于部署的文档:

http://docs.bokeh.org/en/0.11.1/docs/user_guide/server.html

包括有关在反向代理后面运行、使用负载平衡器和进程管理器以及使用 Salt 等工具实现自动化的信息。 never 服务器更健壮、可扩展且易于使用。您可以在此处查看自 2016 年 1 月以来连续“生产”部署的实时 Bokeh 服务器示例库:

http://demo.bokeh.org

作为引用,全自动化部署可以在GitHub上学习:

https://github.com/bokeh/demo.bokeh.org

此外,此处的“Happiness”示例演示了一个相当复杂的嵌入特定于 session 的 Bokeh 服务器应用程序的示例:

https://github.com/bokeh/bokeh/tree/master/examples/embed/server_session

但最后我要说的是,即将发布的 0.12 版本将能够为 Bokeh 应用程序设置自定义 Jinja 模板,这意味着可以提供像单页应用程序这样大量围绕 Bokeh 文档构建的应用程序直接来自 Bokeh 服务器,无需嵌入另一个网络服务器(如果需要)。

关于python - 无法让 Bokeh 服务器在服务器上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33356654/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com