I’m inquiring about the possibilities of dynamically configuring Bokeh docs from a Flask application.
The data which will be presented in the bokeh doc is to be supplied from a Flask app. We have different users who have identically structured data that differs in size and value. I’m not sure how one would go about discriminating users within the bokeh-doc code, so, I’ve been passing data from Flask to the bokeh doc through it’s root.
To summarize the setup:
I have a template doc that I set up with skeleton ColumnDataSources which are then added to the document root.
Then, in my Flask application, I use pull_session( ) and populate the ColumnDataSources from session.document.roots to update the plot.
The bokeh-server is initiated when the Flask app is started and is configured to serve this app/doc.
This has worked pretty well so far but I think I’m reaching a limit with this method. For example, I generate a Legend object in my flask app, pull the Figure object from session.document.roots, and then use add_layout( ) to add the Legend to the plot. However, not all legend items are always rendered. To get all items to render, I have to refresh the page once.
I’d like to know if this is even an advisable method and if there are any other ways to do this in a cleaner and safer fashion.