由於跨域問題,我無法獲得bokeh
陰謀以在部署的服務器上工作。我以幾種形式提出了這個問題,並沒有真正獲得任何地方。無法讓散景服務器在服務器上運行
無論我運行一個applet或試圖嵌入一個圖,我總是得到錯誤
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})
這個腳本返回到我的javascript內的ajax
通話中獲取一個劇情腳本。然後將此腳本附加到相應的<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;
...
}
有沒有人成功地與在生產環境中運行bokeh
服務器嵌入式bokeh
地塊的燒瓶中的應用?
「響應中有HTTP狀態碼500」表明你沒有正確設置你的服務器 –
@BenjaminHodgson你可以擴展嗎? –
那麼,它會返回一個500內部服務器錯誤,這通常表示處理請求的服務器中的未捕獲異常。它看起來像一個CORS問題,因爲500導致Access-Control-Allow-Origin頭部丟失。 –