Embedding Bokeh plot in Django website results in blank page with no error message

僤鯓⒐⒋嵵緔 提交于 2019-11-30 20:30:51
Frikster

My issue is easily explained by @bigreddot in the comments.

Changing simple_chart.html as below solved the issue.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Experiment with Bokeh</title>
    <script src="http://cdn.pydata.org/bokeh/release/bokeh-0.11.0.min.js"></script>
    <link rel="stylesheet" href="http://cdn.pydata.org/bokeh/release/bokeh-0.11.0.min.css">
    {{the_script|safe}}
</head>
<body>

    {{the_div|safe}}

</body>
</html>

Please note that if you still have issues (i.e. blank bokeh plots) and you are a pycharm user, it may be due to a potential bug in a recent update: PyCharm 5.0.4 #143.1919.1. Try running via the terminal, if it works then there is likely something wrong with pycharm, not your code.

http://blog.jetbrains.com/pycharm/#post-3302

Also, scroll down to see how the issue may have been resolved at the following links:

https://youtrack.jetbrains.com/issue/PY-16021

Bokeh plot does not appear on the same django page after csv upload

I had similar issue culprit was bokeh version. I am using PyCharm 2017.3.4 (Community Edition)

I had copied

<script src="http://cdn.pydata.org/bokeh/release/bokeh-0.11.0.min.js"></script>
<link rel="stylesheet" href="http://cdn.pydata.org/bokeh/release/bokeh-0.11.0.min.css">

Check bokeh version e.g. pip freeze and get bokeh version bokeh==0.12.14

Then change above appropriately

<script src="http://cdn.pydata.org/bokeh/release/bokeh-0.12.14.min.js"></script>
<link rel="stylesheet" href="http://cdn.pydata.org/bokeh/release/bokeh-0.12.14.min.css">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!