from bokeh.plotting import figure, output_file, show from bokeh.embed import components def request_handler(request): p = figure(plot_width=400, plot_height=400) # add a line renderer with a NaN nan = float('nan') p.line([1, 2, 3, nan, 4, 5], [6, 7, 2, 4, 4, 5], line_width=2) p.toolbar.logo = None script, div = components(p) output = r""" Bokeh Scatter Plots {} {} """.format(script,div) return output