Hi Nicolas,
Thanks for your good questions. First I wanted to mention that I have started work on a new Users Guide which will have much better information and examples around embedding, server apps, etc.
The main advantage of a server app is the two way communication between the python code and app in the browser. In particular, if you want to:
- react and respond to changes in plot selections
or
- use Bokeh’s widgets and react and respond to changes in those
Then a server app is really the only route to go. If neither of these things is true, then you could do a server app, but it’s not required. If you just want to push data to update a plot, for instance, you can embed it using:
autoload_server(...)
And then another process (probably your flask or django app) can update the data, which will cause the plot to update.
Regarding the server, you should need one at most. There are ways to run multiple scripts in one server. The easiest it probably just to import the other modules in a new .py file, and use that .py file as your script. If you are using the server in multi-user mode there are config files. Let me know and I can get you more info while I am still working on the docs.
It’s also possible to embed and update using embed.components, but it is much more “coarse grained”. This is going to generate and send the entire plot object every time. There are times when this is perfectly fine. You are correct that if you put several plots into a layout and call embed.components on the entire layout, then you give up control over rendering the plots individually. You could certainly call embed.components on each individual plot (getting a tag for each), but then you are going to have to layout the plots yourself when you render the page, or do some kind of partial page update.
There are probably other questions generated by this but let me stop here and see if what I’ve already said makes sense.
Bryan
I’m wondering in which situation is it better to use applets vs embedding (considering the case of a webapp), and what are the limits of each approach.
After reading the doc (this section of the user_guide & and the examples and these SO questions (one, two)) - there’s still a couple of dark spots for me.
Applets feel overall better (performance, can do dynamic plots with plotting interface), but i have two concerns about them :
- Is it advisable to use applets for a multi-page web app ? In that case, should we have one bokeh-server instance per page, with it’s own script ?
- It does not seem possible to do per component integration in html - it’s just one single block of js (because we receive only one tag
_tag). correct ?
Currently i’m using embedding - it was easy to start as there were many examples.
The drawback of embedding is that it doesn’t seem possible to do dynamic plots using the plotting interface - I haven’t seen any example doing that. Is that correct, or am I missing something ?
Thanks,
Nicolas
–
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9da63a55-15ff-473b-99de-e52a17838da5%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.