Bokeh HTML Requests Advice

I’m currently running Bokeh 0.12.1 with Django 1.9.8.

I’m running an app with
bokeh serve emptydetails_graph.py

``

Let’s say the emptydetails_graph.py running on the bokeh server is this:

from bokeh.plotting import figure, show, output_server

p = figure(title="Server Plot")
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)

I would like to pass an argument from Django to start a new session similar to this:

from bokeh.plotting import figure, show, output_server
p = figure(title=**STRING PARAMETER FROM DJANGO**)
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)

Obviously my use case is different, the main goal being I would like to pass a string from Django to a Bokeh App, when creating a new session.

the_script = autoload_server(model=None,app_path='/emptydetails_graph',url="http://127.0.0.1:5006/", **STRING PARAMETER HERE**)

How would I do this?

I read throught the docs and found this http://bokeh.pydata.org/en/latest/docs/user_guide/server.html#accessing-the-http-request whcih would tell me that my bokeh app should include:

**imports**

args = curdoc().session_context.request.arguments

p = figure(title=**string(args.get('Name')[0]**)
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)

yet I am still confused on how to set the arguments with autoload_server

the_script = autoload_server(model=None,app_path=‘/emptydetails_graph’,url=“http://127.0.0.1:5006/”)

···

On Tuesday, September 13, 2016 at 10:33:20 AM UTC-5, Robbie Pritchard wrote:

I’m currently running Bokeh 0.12.1 with Django 1.9.8.

I’m running an app with
bokeh serve emptydetails_graph.py

``

Let’s say the emptydetails_graph.py running on the bokeh server is this:

from bokeh.plotting import figure, show, output_server

p = figure(title="Server Plot")
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)

I would like to pass an argument from Django to start a new session similar to this:

from bokeh.plotting import figure, show, output_server
p = figure(title=**STRING PARAMETER FROM DJANGO**)
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)

Obviously my use case is different, the main goal being I would like to pass a string from Django to a Bokeh App, when creating a new session.

the_script = autoload_server(model=None,app_path='/emptydetails_graph',url="[http://127.0.0.1:5006/](http://127.0.0.1:5006/)", **STRING PARAMETER HERE**)
How would I do this?

Richard,

That section only applies to bokeh apps run directly on the bokeh server, i.e., run as:

  bokeh serve myapp.py

Then in your autoload call, you could add custom HTML request arguments to the app_path, and when the session is created for that autoload call.

Please not output_server is very limited inherently, and I just opened an issue to discuss deprecating/removing it. A newar identical question was on this list earlier today, please see my longer response there:

  Redirecting to Google Groups

Thanks,

Bryan

···

On Sep 13, 2016, at 11:33 AM, Robbie Pritchard <[email protected]> wrote:

I read throught the docs and found this Bokeh server — Bokeh 3.3.2 Documentation whcih would tell me that my bokeh app should include:
imports

args = curdoc().session_context.request.arguments

p = figure(title=string(args.get('Name')[0])
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)

yet I am still confused on how to set the arguments with autoload_server
the_script = autoload_server(model=None,app_path='/emptydetails_graph',url="http://127.0.0.1:5006/&quot;\)

On Tuesday, September 13, 2016 at 10:33:20 AM UTC-5, Robbie Pritchard wrote:
I'm currently running Bokeh 0.12.1 with Django 1.9.8.

I'm running an app with
bokeh serve emptydetails_graph.py

Let's say the emptydetails_graph.py running on the bokeh server is this:
from bokeh.plotting import figure, show, output_server

p = figure(title="Server Plot")
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)

I would like to pass an argument from Django to start a new session similar to this:

from bokeh.plotting import figure, show, output_server

p = figure(title=STRING PARAMETER FROM DJANGO)
p.circle([1, 2, 3], [4, 5, 6])

output_server("hover")

show(p)
Obviously my use case is different, the main goal being I would like to pass a string from Django to a Bokeh App, when creating a new session.
the_script = autoload_server(model=None,app_path='/emptydetails_graph',url="http://127.0.0.1:5006/&quot;, STRING PARAMETER HERE)

How would I do this?

--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0113d8c-4c9a-4950-a876-e2e7c6070eaf%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Oh sorry about that. this app is currently running on
bokeh serve myapp.py

``

I just picked a random sample app to illustrate the problem of pushing the argument to bokeh. my app doesn’t use output_server().

would this be the right?

the_script = autoload_server(model=None,app_path=’/myapp**?name=“company_name”**’,url=“http://127.0.0.1:5006/”)

and then access it with:

args = curdoc().session_context.request.arguments

name = **string(args.get('name')[0]**)

``

Thanks for the help!

<details class='elided'>
<summary title='Show trimmed content'>&#183;&#183;&#183;</summary>

On Tuesday, September 13, 2016 at 11:45:47 AM UTC-5, Bryan Van de ven wrote:
> Richard,
> 
> 
> 
> That section only applies to bokeh apps run directly on the bokeh server, i.e., run as:
> 
> 
> 
>         bokeh serve myapp.py
> 
> 
> 
> Then in your autoload call, you could add custom HTML request arguments to the app_path, and when the session is created for that autoload call.
> 
> 
> Please not output_server is very limited inherently, and I just opened an issue to discuss deprecating/removing it. A newar identical question was on this list earlier today, please see my longer response there:
> 
> 
> 
>         [https://groups.google.com/a/continuum.io/forum/?pli=1#!topic/bokeh/QNFpo8r0gf8](https://groups.google.com/a/continuum.io/forum/?pli=1#!topic/bokeh/QNFpo8r0gf8)
> 
> 
> 
> Thanks,
> 
> 
> 
> Bryan
> 
> 
> 
> 
> > On Sep 13, 2016, at 11:33 AM, Robbie Pritchard <[email protected]> wrote:
> 
> >
> > I read throught the docs and found this [http://bokeh.pydata.org/en/latest/docs/user_guide/server.html#accessing-the-http-request](http://bokeh.pydata.org/en/latest/docs/user_guide/server.html#accessing-the-http-request) whcih would tell me that my bokeh app should include:
> 
> > imports
> 
> >
> > args = curdoc().session_context.request.arguments
> 
> >
> >
> >
> > p = figure(title=string(args.get('Name')[0])
> 
> > p.circle([1, 2, 3], [4, 5, 6])
> 
> >
> >
> >
> > output_server("hover")
> 
> >
> >
> >
> > show(p)
> 
> >
> > yet I am still confused on how to set the arguments with autoload_server
> 
> > the_script = autoload_server(model=None,app_path='/emptydetails_graph',url="[http://127.0.0.1:5006/](http://127.0.0.1:5006/)")
> 
> >
> >
> >
> >
> > On Tuesday, September 13, 2016 at 10:33:20 AM UTC-5, Robbie Pritchard wrote:
> > I'm currently running Bokeh 0.12.1 with Django 1.9.8.
> 
> >
> > I'm running an app with
> > bokeh serve emptydetails_graph.py
> 
> >
> >
> > Let's say the emptydetails_graph.py running on the bokeh server is this:
> 
> > from bokeh.plotting import figure, show, output_server
> 
> >
> >
> >
> > p = figure(title="Server Plot")
> 
> > p.circle([1, 2, 3], [4, 5, 6])
> 
> >
> >
> >
> > output_server("hover")
> 
> >
> >
> >
> > show(p)
> 
> >
> > I would like to pass an argument from Django to start a new session similar to this:
> 
> >
> > from bokeh.plotting import figure, show, output_server
> 
> >
> >
> >
> > p = figure(title=STRING PARAMETER FROM DJANGO)
> 
> > p.circle([1, 2, 3], [4, 5, 6])
> 
> >
> >
> >
> > output_server("hover")
> 
> >
> >
> >
> > show(p)
> 
> > Obviously my use case is different, the main goal being I would like to pass a string from Django to a Bokeh App, when creating a new session.
> 
> > the_script = autoload_server(model=None,app_path='/emptydetails_graph',url="[http://127.0.0.1:5006/](http://127.0.0.1:5006/)", STRING PARAMETER HERE)
> 
> >  
> 
> > How would I do this?
> >
> > --
> > 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 [email protected].
> 
> > To post to this group, send email to [email protected].
> 
> > To view this discussion on the web visit [https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0113d8c-4c9a-4950-a876-e2e7c6070eaf%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/a0113d8c-4c9a-4950-a876-e2e7c6070eaf%40continuum.io).
> 
> > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
> 
> 
>

</details>