Deploying bo

I am trying to use bokeh to plot a streaming plot on a web app. I have a html which I want to embed a dynamic plot. I have copied an example and the autoload_server in an attempt to render a dynamic plot using flask. My knowledge of bokeh and web development in general is shallow, hence I am not sure how to get this plot to work. In future I would like to change the update function to call a database server and return new values.

Any help is greatly appreciated.

@app.route(’/view’, methods=[‘POST’, ‘GET’])
def showGraphView():
from bokeh.client import push_session
from bokeh.embed import autoload_server
from bokeh.plotting import figure, curdoc
from math import cos, sin
from bokeh.io import curdoc
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure

p = figure(x_range=(-1.1, 1.1), y_range=(-1.1, 1.1))
p.circle(x=0, y=0, radius=1, fill_color=None, line_width=2)

# this is the data source we will stream to
source = ColumnDataSource(data=dict(x=[1], y=[0]))
p.circle(x='x', y='y', size=12, fill_color='white', source=source)

def update():
    x, y = source.data['x'][-1], source.data['y'][-1]

    # construct the new values for all columns, and pass to stream
    new_data = dict(x=[x*cos(0.1) - y*sin(0.1)], y=[x*sin(0.1) + y*cos(0.1)])
    source.stream(new_data, rollover=8)

curdoc().add_periodic_callback(update, 150)
curdoc().add_root(p)

session = push_session(curdoc())
return autoload_server(p, session_id=session.id)

# here I try to render a html template to display the plot
(_, plot_div) = components(p)
return render_template('view.html', script=script, div=plot_div)

``