Implementing user generated bokeh app sessions

Hi everyone,

I am working on a django project where, in essence, the workflow will be:

  1. user uploads data
  2. data gets processed server-side
  3. a bokeh application is generated and served to the user.

With regards to 3. I am having some trouble. Specifically, I want the bokeh application to be served at a unique url address (using pk or a similar value) viewable only by the user, and I was trying to do that using the django channels implementation of bokeh.

Before I invest more time into this, however, I wanted to know if this approach is possible in the first place using the bokeh support for django channels. If so, what’s a good starting point and if not, what would be a good alternative solution (i.e. bokeh alternative)?

My main concern is how I would go about ensuring that the multiple bokeh app sessions do not conflict with each other.

I would very much appreciate any comment/suggestion/advice.

Thank you!

Some preliminary findings.

By using the bokeh implementation of django channels and the sea_surface_custom_url definition in the django_embed example as a starting template and using the arguments parameter to server_document, I managed to create a very simple setup that seems to do what I want.

So based on my current understanding, the answer to my questions should be that yes, it is possible to use django channels to serve multiple and unique bokeh applications to the user and a good starting point is what I wrote above. Alternatively, it should also be possible to call external bokeh serve commands to achieve the same result, albeit less elegantly.

As for the conflict between multiple bokeh apps, there doesn’t seem to be any.

@bisejdiu As I mentioned in the first response, you can pass “extra” per-session data as HTTP request arguments by passing arguments to server_document, and then these values are available to the app code as described. That is how I would customize per-session at present. Once Bokeh 2.0 lands, there will also be options to send per-session data inside a token.