title: How to correctly deploy Bokeh app requiring server callbacks?
body: <p>I want to use a Bokeh server to persist my plot and data, so I can embed my Bokeh app in a website. I'm trying to recreate the <a href="http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html" rel="nofollow noreferrer">example</a> given on the Bokeh 0.12.6 documentation:</p>
  
  <pre><code>from bokeh.client import push_session
  from bokeh.embed import autoload_server
  from bokeh.plotting import figure, curdoc
  
  # figure() function auto-adds the figure to curdoc()
  plot = figure()
  plot.circle([1,2], [3,4])
  
  session = push_session(curdoc())
  script = autoload_server(plot, session_id=session.id)
  </code></pre>
  
  <p>So I'm starting a Bokeh server and running this python program as such:</p>
  
  <pre><code>bokeh serve --show animated.py
  </code></pre>
  
  <p>The error I'm getting looks like this:</p>
  
  <pre><code>File "session.py", line 298, in push:
  raise IOError("Cannot push session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command)") Traceback (most recent call last):
  File "/Users/.../anaconda/lib/python3.5/site-packages/bokeh/application/handlers/code_runner.py", line 81, in run
  exec(self._code, module.__dict__)
  File "/Users/.../Documents/.../.../animated.py", line 9, in &lt;module&gt;
  session = push_session(curdoc())
  File "/Users/.../anaconda/lib/python3.5/site-packages/bokeh/client/session.py", line 86, in push_session
  session.push(document)
  File "/Users/.../anaconda/lib/python3.5/site-packages/bokeh/client/session.py", line 298, in push
  raise IOError("Cannot push session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command)")
  OSError: Cannot push session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command)
  </code></pre>
  
  <p>How should I go about fixing this problem? And if autoload_server() is the completely wrong approach, what are other ways to deploy a Bokeh app?</p>