Trying to use the 'Export CSV' Bokeh Demo

Hello, basically I am using my file to render Bokeh scripts onto HTML pages using Django. What I would do usually with a plot is :

script1, div1 = components(graph_to_export)

but with the export csv example found at:

I get the error message:

cannot unpack non-iterable Document object

In my HTML file, I usually use {{ div1|safe }}, while they use {{ super() }}

I’m looking to know how I can export the script to my html properly, thanks!

curdoc().add_root(row(controls, data_table))
curdoc().title = "Export CSV"


#trying to export this code into an object
script2, div2=components( curdoc()) (?)

I think some more context is needed. It’s unusual to use curdoc() (mostly only used in Bokeh server applications) used together with components (which is explicitly for standalone-only content).