title: Embedding a plot in a website with Python/bokeh
body: <p>I am trying to statically embed a bokeh plot in a personal website, and am encountering some behavior I do not understand.  Basically, I am generating a plot using bokeh as follows:</p>
  
  <pre><code>import bokeh.plotting as bplt
  import numpy as np
  
  x=np.random.random(100)
  y=np.random.random(100)
  
  bplt.output_file("t.html")
  plot=bplt.line(x,y)
  
  ##the following line refers to the bokeh installed on my home computer
  print plot.create_html_snippet(
             static_path='/usr/local/lib/python2.7/site-packages/bokeh/server/static/')
  
  ##the following line refers to the bokeh installed on my remote computer
  #print plot.create_html_snippet(
  #           static_path='/opt/anaconda/lib/python2.7/site-packages/bokeh/server/static/')
  </code></pre>
  
  <p>So far so good.  This produces a file that looks like <code>(random garbage).embed.js</code>, and a prints string containing html syntax that I manually copy into an html file I am calling <code>testembed.html</code>, which I have reproduced below:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;h2&gt;Simple Embed Example&lt;/h2&gt;
  &lt;p&gt;This is where my plot should be:&lt;/p&gt;
  &lt;p&gt;
  &lt;!--The next 4 lines are the output of the print statement from the python code--&gt;
  &lt;script src="ccbd451a-6995-4dd2-b99c-e4140b362997.embed.js"
          bokeh_plottype="embeddata"
          bokeh_modelid="ccbd451a-6995-4dd2-b99c-e4140b362997"
          bokeh_modeltype="Plot" async="true"&gt;&lt;/script&gt;
  &lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>If I have the python code reference my <em>local</em> python installation and copy the generated files (.html and .embed.js) to my local computer, I <strong>can see</strong> the plot in the html file.</p>
  
  <p>However, what I really want to do is have this run on a remote computer, and have the html file accessible through the web on my personal site.</p>
  
  <p>When I have <code>static_path</code> refer to my <em>remote computer's</em> python install (as shown above, commented out), I <strong>can't see the plot</strong> in the html page when I access it through the web (ie, going to <a href="http://mywebsite.com/testembed.html" rel="noreferrer">http://mywebsite.com/testembed.html</a>).  I have no idea why this is happening.</p>
  
  <p>For reference, here is the code where the html snippet function is defined:
  <a href="https://github.com/ContinuumIO/bokeh/blob/master/bokeh/objects.py#L309" rel="noreferrer">https://github.com/ContinuumIO/bokeh/blob/master/bokeh/objects.py#L309</a>
  and I note there is an option I am <em>not</em> passing in <code>create_html_snippet</code>, ie,  <code>embed_base_url</code>, which <em>could</em> have something to do with this.</p>
  
  <p>Thanks in advance!
  Mike</p>
  
  <p><strong>EDIT</strong>
  I took <code>bigreddot</code>'s advice, which solved the problem.  The actual problem I had been having was that the webserver I was using was, for security purposes, only able to access things in my <code>public_html</code> directory.  The workaround was to <code>rsync</code> the <code>bokeh/static</code> directory into my <code>public_html</code> and point to that:</p>
  
  <pre><code>rsync -ax /opt/anaconda/lib/python2.7/site-packages/bokeh/server/static/ /home/myusername/public_html/bokeh-static/
  </code></pre>
  
  <p>and then modify my code as follows:</p>
  
  <pre><code>import bokeh.plotting as bplt
  import numpy as np
  
  x=np.random.random(100)
  y=np.random.random(100)
  
  bplt.output_file("t.html")
  plot=bplt.line(x,y)
  
  
  #the following line refers to the bokeh rsynced to my directory
  print plot.create_html_snippet(
             static_path='http://www.my_server_website/~myusername/bokeh-static/', 
             embed_base_url = 'http://www.my_server_website/~myusername/where_.js_file_is_located')
  </code></pre>
  
  <p>and then obviously copy the generated html into the <code>testembed.html</code>.</p>