Tutorial: Django Website hosting Bokeh Server Plots

I created a tutorial demonstrating how to build and deploy a Django Website that hosts Bokeh Server (and static) plots.

You can find the github repo here:

The live site is here, although I won’t keep this up permanently:

http://45.33.6.39

If you have a moment, please consider checking it out and giving me your feedback. Thanks to all on this list (particularly you, Bryan) for all the help along the way.

Cheers,

Jonathan

···

Jonathan Bennett
Kono Analytics
p:
713.489.4338
w:
konoanalytics.com

1 Like

This is fantastic, thanks for putting it together! Please consider contributing a docs PR to Bokeh to point at it,

Thanks,

Bryan

···

On Nov 8, 2017, at 11:06, Jonathan Bennett <[email protected]> wrote:

I created a tutorial demonstrating how to build and deploy a Django Website that hosts Bokeh Server (and static) plots.

You can find the github repo here:
https://github.com/konoanalytics/BokehDjango

The live site is here, although I won't keep this up permanently:
http://45.33.6.39

If you have a moment, please consider checking it out and giving me your feedback. Thanks to all on this list (particularly you, Bryan) for all the help along the way.

Cheers,
Jonathan

--

Jonathan Bennett
Kono Analytics
p: 713.489.4338
w: konoanalytics.com
    
--
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/8ddaef72-e3ef-4177-9527-7a93aa8cf1d8%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks, I’m happy to do so, but I might need some hand holding. I’ve never contributed to an open source project, so can someone point me in the right direction? I’m not really sure where to start.

I’ll dive into this link, but any additional help would be appreciated:

https://bokeh.pydata.org/en/latest/docs/dev_guide/documentation.html#devguide-documentation

Cheers,

jonathan

···

On Wed, Nov 8, 2017 at 4:58 PM, Bryan Van de ven [email protected] wrote:

This is fantastic, thanks for putting it together! Please consider contributing a docs PR to Bokeh to point at it,

Thanks,

Bryan

On Nov 8, 2017, at 11:06, Jonathan Bennett [email protected] wrote:

I created a tutorial demonstrating how to build and deploy a Django Website that hosts Bokeh Server (and static) plots.

You can find the github repo here:

https://github.com/konoanalytics/BokehDjango

The live site is here, although I won’t keep this up permanently:

http://45.33.6.39

If you have a moment, please consider checking it out and giving me your feedback. Thanks to all on this list (particularly you, Bryan) for all the help along the way.

Cheers,

Jonathan

Jonathan Bennett

Kono Analytics

p: 713.489.4338

w: konoanalytics.com

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/8ddaef72-e3ef-4177-9527-7a93aa8cf1d8%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/N7GlMCjiTFY/unsubscribe.

To unsubscribe from this group and all its topics, 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/E798C27E-22B6-4D44-9D9F-26CC7EEB325D%40anaconda.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Jonathan Bennett
Kono Analytics
p:
713.489.4338
w:
konoanalytics.com

Thanks for this example, Jonathan. I got a grasp of how to get a plot (Bokeh app) embedded into a django view.

I see that in the examples, the data is random numbers generated inside the bokeh app. How would you go about getting the data to the plots from Django models (from a Postgres database)?

I understand that there can be a lot of options, but what could be the best, when working on quite large datasets?

···

On Friday, 10 November 2017 17:16:25 UTC+2, Jonathan Bennett wrote:

Thanks, I’m happy to do so, but I might need some hand holding. I’ve never contributed to an open source project, so can someone point me in the right direction? I’m not really sure where to start.

I’ll dive into this link, but any additional help would be appreciated:

https://bokeh.pydata.org/en/latest/docs/dev_guide/documentation.html#devguide-documentation

Cheers,

jonathan

On Wed, Nov 8, 2017 at 4:58 PM, Bryan Van de ven [email protected] wrote:

This is fantastic, thanks for putting it together! Please consider contributing a docs PR to Bokeh to point at it,

Thanks,

Bryan

On Nov 8, 2017, at 11:06, Jonathan Bennett [email protected] wrote:

I created a tutorial demonstrating how to build and deploy a Django Website that hosts Bokeh Server (and static) plots.

You can find the github repo here:

https://github.com/konoanalytics/BokehDjango

The live site is here, although I won’t keep this up permanently:

http://45.33.6.39

If you have a moment, please consider checking it out and giving me your feedback. Thanks to all on this list (particularly you, Bryan) for all the help along the way.

Cheers,

Jonathan

Jonathan Bennett

Kono Analytics

p: 713.489.4338

w: konoanalytics.com

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/8ddaef72-e3ef-4177-9527-7a93aa8cf1d8%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/N7GlMCjiTFY/unsubscribe.

To unsubscribe from this group and all its topics, 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/E798C27E-22B6-4D44-9D9F-26CC7EEB325D%40anaconda.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Jonathan Bennett
Kono Analytics
p:
713.489.4338
w:
konoanalytics.com

Hi Niko!

Are you looking to optimize the I/O from a postgres database? I have a project requires the visualization of lots of data, but the data is only updated on a daily basis. So I wrote a separate program that pulls and slices/dices/cleans/aggregates the data and writes the output to a csv file. It runs (via a cron job) once per day. The bokeh server application reads that

file and does its magic so I don’t have to hit the database every time I want to update a bokeh viz.

If that’s not a possible then there are architectural issues with your application that you can address like:

  1. Placing the database close to the server like using an AWS cluster

  2. Optimize all queries and indexing tables appropriately

  3. Creating database views and/or stored procedures that create temporary tables to pre-process your queries

Does that answer your question, or did I miss the intent?

Cheers,

Jonathan

···

On Wed, Nov 15, 2017 at 4:11 AM, [email protected] wrote:

Thanks for this example, Jonathan. I got a grasp of how to get a plot (Bokeh app) embedded into a django view.

I see that in the examples, the data is random numbers generated inside the bokeh app. How would you go about getting the data to the plots from Django models (from a Postgres database)?

I understand that there can be a lot of options, but what could be the best, when working on quite large datasets?

On Friday, 10 November 2017 17:16:25 UTC+2, Jonathan Bennett wrote:

Thanks, I’m happy to do so, but I might need some hand holding. I’ve never contributed to an open source project, so can someone point me in the right direction? I’m not really sure where to start.

I’ll dive into this link, but any additional help would be appreciated:

https://bokeh.pydata.org/en/latest/docs/dev_guide/documentation.html#devguide-documentation

Cheers,

jonathan

On Wed, Nov 8, 2017 at 4:58 PM, Bryan Van de ven [email protected] wrote:

This is fantastic, thanks for putting it together! Please consider contributing a docs PR to Bokeh to point at it,

Thanks,

Bryan

On Nov 8, 2017, at 11:06, Jonathan Bennett [email protected] wrote:

I created a tutorial demonstrating how to build and deploy a Django Website that hosts Bokeh Server (and static) plots.

You can find the github repo here:

https://github.com/konoanalytics/BokehDjango

The live site is here, although I won’t keep this up permanently:

http://45.33.6.39

If you have a moment, please consider checking it out and giving me your feedback. Thanks to all on this list (particularly you, Bryan) for all the help along the way.

Cheers,

Jonathan

Jonathan Bennett

Kono Analytics

p: 713.489.4338

w: konoanalytics.com

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/8ddaef72-e3ef-4177-9527-7a93aa8cf1d8%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/N7GlMCjiTFY/unsubscribe.

To unsubscribe from this group and all its topics, 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/E798C27E-22B6-4D44-9D9F-26CC7EEB325D%40anaconda.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Jonathan Bennett
Kono Analytics
p:
713.489.4338
w:
konoanalytics.com

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/N7GlMCjiTFY/unsubscribe.

To unsubscribe from this group and all its topics, 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/f5029e50-0cbe-4f2a-bc91-c1320efb41be%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Jonathan Bennett
Kono Analytics
p:
713.489.4338
w:
konoanalytics.com

Hi Jonathan,

Thanks for your response. I’m not really optimizing yet, and there are no optimizations needed in the near future. I’m just starting with all of this (django, bokeh & web development), so maybe I am asking for a trivial thing. Basically I just want to read data from the Postgres database. The data is written by django (using django models and django ORM). All the applications (postgres, django, bokeh) are running on the same Ubuntu machine.

I was wondering if the correct implementation would be to

a) Read the data in django’s views.py, using the basic django operations (MyModel.objects.filter(…)), and pass the data to bokeh server somehow. The amount of data could be few megabytes to few tens of megabytes. This does not feel the correct option, since how would I implement for example this: 1) First, user selects different range on a slider widget 2) Then, fetch new data from database. (?) I don’t think that is doable using this option.

b) Read the data using django’s models and ORM inside the bokeh application. Not sure if it is possible. If it was, then also writing data could be made possible from the bokeh app (useful feature, for example for tagging data by hand. Maybe adding comments etc.)

c) Read the data inside the bokeh application, using custom (SQLAlchemy?) implementation.

d) Perhaps make a celery/cron job to pull out data from the database every few minutes to a big .csv-file. Does not feel optimal, and does not allow writes back to database.

e) Something else

– Niko

···

On Wednesday, 15 November 2017 16:04:53 UTC+2, Jonathan Bennett wrote:

Hi Niko!

Are you looking to optimize the I/O from a postgres database? I have a project requires the visualization of lots of data, but the data is only updated on a daily basis. So I wrote a separate program that pulls and slices/dices/cleans/aggregates the data and writes the output to a csv file. It runs (via a cron job) once per day. The bokeh server application reads that

file and does its magic so I don’t have to hit the database every time I want to update a bokeh viz.

If that’s not a possible then there are architectural issues with your application that you can address like:

  1. Placing the database close to the server like using an AWS cluster
  1. Optimize all queries and indexing tables appropriately
  1. Creating database views and/or stored procedures that create temporary tables to pre-process your queries

Does that answer your question, or did I miss the intent?

Cheers,

Jonathan

On Wed, Nov 15, 2017 at 4:11 AM, [email protected] wrote:

Thanks for this example, Jonathan. I got a grasp of how to get a plot (Bokeh app) embedded into a django view.

I see that in the examples, the data is random numbers generated inside the bokeh app. How would you go about getting the data to the plots from Django models (from a Postgres database)?

I understand that there can be a lot of options, but what could be the best, when working on quite large datasets?

On Friday, 10 November 2017 17:16:25 UTC+2, Jonathan Bennett wrote:

Thanks, I’m happy to do so, but I might need some hand holding. I’ve never contributed to an open source project, so can someone point me in the right direction? I’m not really sure where to start.

I’ll dive into this link, but any additional help would be appreciated:

https://bokeh.pydata.org/en/latest/docs/dev_guide/documentation.html#devguide-documentation

Cheers,

jonathan

On Wed, Nov 8, 2017 at 4:58 PM, Bryan Van de ven [email protected] wrote:

This is fantastic, thanks for putting it together! Please consider contributing a docs PR to Bokeh to point at it,

Thanks,

Bryan

On Nov 8, 2017, at 11:06, Jonathan Bennett [email protected] wrote:

I created a tutorial demonstrating how to build and deploy a Django Website that hosts Bokeh Server (and static) plots.

You can find the github repo here:

https://github.com/konoanalytics/BokehDjango

The live site is here, although I won’t keep this up permanently:

http://45.33.6.39

If you have a moment, please consider checking it out and giving me your feedback. Thanks to all on this list (particularly you, Bryan) for all the help along the way.

Cheers,

Jonathan

Jonathan Bennett

Kono Analytics

p: 713.489.4338

w: konoanalytics.com

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/8ddaef72-e3ef-4177-9527-7a93aa8cf1d8%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/N7GlMCjiTFY/unsubscribe.

To unsubscribe from this group and all its topics, 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/E798C27E-22B6-4D44-9D9F-26CC7EEB325D%40anaconda.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Jonathan Bennett
Kono Analytics
p:
713.489.4338
w:
konoanalytics.com

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/N7GlMCjiTFY/unsubscribe.

To unsubscribe from this group and all its topics, 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/f5029e50-0cbe-4f2a-bc91-c1320efb41be%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Jonathan Bennett
Kono Analytics
p:
713.489.4338
w:
konoanalytics.com

Hi Niko,

You can implement a REST-View with django that delivers data to the

bokeh-server.
This is possible. But you have to extend the path and setting that
the bokeh server has access to your apps and modules:
e.g. like this:
‘’’

Get access to django ORM

django_base_path =
os.path.abspath(os.path.join(os.path.dirname(file), ‘…’,
…))
sys.path.append(base_path)
os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘my_site.settings’

now you can

from mysite.models import MyModel
‘’’
Do not use the bokeh server! To be honest, I never used bokeh-server
with django. Why not solve all your problems with the powerful
CustomJS-possibilities?
I think there are examples in jonathan`s tutorial project.
Raffs

···

On 2017-11-15 16:27, wrote:

[email protected]

Hi Jonathan,

      Thanks for your response. I'm not really optimizing yet,

and there are no optimizations needed in the near future. I’m
just starting with all of this (django, bokeh & web
development), so maybe I am asking for a trivial thing.
Basically I just want to read data from the Postgres database.
The data is written by django (using django models and django
ORM). All the applications (postgres, django, bokeh) are
running on the same Ubuntu machine.

I was wondering if the correct implementation would be to

      a) Read the data in django's views.py, using the basic

django operations (MyModel.objects.filter(…)), and pass the
data to bokeh server somehow. The amount of data could be few
megabytes to few tens of megabytes. This does not feel the
correct option, since how would I implement for example this:

  1. First, user selects different range on a slider widget 2)
    Then, fetch new data from database. (?) I don’t think that is
    doable using this option.
      b) Read the data using django's models and ORM inside the

bokeh application. Not sure if it is possible. If it was, then
also writing data could be made possible from the bokeh app
(useful feature, for example for tagging data by hand. Maybe
adding comments etc.)

      c) Read the data inside the bokeh application, using

custom (SQLAlchemy?) implementation.

      d) Perhaps make a celery/cron job to pull out data from

the database every few minutes to a big .csv-file. Does not
feel optimal, and does not allow writes back to database.

e) Something else

– Niko

      On Wednesday, 15 November 2017 16:04:53 UTC+2, Jonathan

Bennett wrote:

Hi Niko!

            Are you looking to optimize the I/O from a postgres

database? I have a project requires the visualization
of lots of data, but the data is only updated on a daily
basis. So I wrote a separate program that pulls and
slices/dices/cleans/aggregates the data and writes the
output to a csv file. It runs (via a cron job) once per
day. The bokeh server application reads that

            file and does its magic so I don't have to hit the

database every time I want to update a bokeh viz.

            If that's not a possible then there are architectural

issues with your application that you can address like:

            1) Placing the database close to the server like

using an AWS cluster

            2) Optimize all queries and indexing tables

appropriately

            3) Creating database views and/or stored procedures

that create temporary tables to pre-process your queries

            Does that answer your question, or did I miss the

intent?

Cheers,

Jonathan

            On Wed, Nov 15, 2017 at 4:11 AM,

[email protected]
wrote:

                Thanks for this example, Jonathan. I

got a grasp of how to get a plot (Bokeh app)
embedded into a django view.

                    I see that in the examples, the data is

random numbers generated inside the bokeh app.
How would you go about getting the data to the
plots from Django models (from a Postgres
database)?

                    I understand that there can be a lot of

options, but what could be the best, when
working on quite large datasets?

                    On Friday, 10 November 2017 17:16:25 UTC+2,

Jonathan Bennett wrote:

                        Thanks, I'm happy to do so, but

I might need some hand holding. I’ve never
contributed to an open source project, so
can someone point me in the right
direction? I’m not really sure where to
start.

                          I'll dive into this link, but any

additional help would be appreciated:

https://bokeh.pydata.org/en/latest/docs/dev_guide/documentation.html#devguide-documentation

Cheers,

jonathan

                          On Wed, Nov 8, 2017

at 4:58 PM, Bryan Van de ven [email protected]
wrote:

                            This is

fantastic, thanks for putting it
together! Please consider contributing a
docs PR to Bokeh to point at it,

                            Thanks,



                            Bryan



                            > On Nov 8, 2017, at 11:06, Jonathan

Bennett <[email protected] >
wrote:

                            >

                            > I created a tutorial demonstrating

how to build and deploy a Django Website
that hosts Bokeh Server (and static)
plots.

                            >

                            > You can find the github repo here:

                            > [https://github.com/konoanalytics/BokehDjango](https://github.com/konoanalytics/BokehDjango)

                            >

                            > The live site is here, although I

won’t keep this up permanently:

                            > [http://45.33.6.39](http://45.33.6.39)

                            >

                            > If you have a moment, please

consider checking it out and giving me
your feedback. Thanks to all on this
list (particularly you, Bryan) for all
the help along the way.

                            >

                            > Cheers,

                            > Jonathan

                            >

                            > --

                            >

                            > Jonathan Bennett

                            > Kono Analytics

                            > p:    713.489.4338

                            > w:    [konoanalytics.com](http://konoanalytics.com)

                            >

                            >

                            >

                                > --

                                > 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/8ddaef72-e3ef-4177-9527-7a93aa8cf1d8%40continuum.io.

                                > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).



                                --

                                You received this message because

you are subscribed to a topic in the
Google Groups “Bokeh Discussion -
Public” group.

                                To unsubscribe from this topic,

visit https://groups.google.com/a/continuum.io/d/topic/bokeh/N7GlMCjiTFY/unsubscribe.

                                To unsubscribe from this group and

all its topics, 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/E798C27E-22B6-4D44-9D9F-26CC7EEB325D%40anaconda.com.

                                For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).
                                                      Jonathan

Bennett
Kono Analytics
p:
713.489.4338
w:
konoanalytics.com

                        --
                  --

                  You received this message because you are

subscribed to a topic in the Google Groups “Bokeh
Discussion - Public” group.

                  To unsubscribe from this topic, visit [https://groups.google.com/a/continuum.io/d/topic/bokeh/N7GlMCjiTFY/unsubscribe](https://groups.google.com/a/continuum.io/d/topic/bokeh/N7GlMCjiTFY/unsubscribe).

                  To unsubscribe from this group and all its topics,

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/f5029e50-0cbe-4f2a-bc91-c1320efb41be%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/f5029e50-0cbe-4f2a-bc91-c1320efb41be%40continuum.io?utm_medium=email&utm_source=footer).

                  For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

                                          Jonathan

Bennett
Kono
Analytics
p:
713.489.4338
w:
konoanalytics.com

  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/423af180-d80b-4b08-881b-6e0baf1cd269%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/423af180-d80b-4b08-881b-6e0baf1cd269%40continuum.io?utm_medium=email&utm_source=footer).

  For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

Hi Raffs,

Thanks for your response.

Do not use the bokeh server! To be honest, I never used bokeh-server

with django.

Why not solve all your problems with the powerful

CustomJS-possibilities?

I was thinking that using separate processes for django and bokeh server could make the site perform better (django can serve request when bokeh is loading data for graphs). The repo also used the bokeh server.

Basically I could also write the CustomJS. I am just trying to find the “best practices” to work with django and bokeh in an application, which involves loading (and possibly saving) data to/from bokeh plots using the same database as django is using. A quick grep-search through the files in the repo tells that there are zero occurences of the word “CustomJS”.

– Niko

Niko,

  One example for CustomJS is. You can load data via ajax and fill

in a DataSource of the bokeh plot.

  Pseudo code

  """
  src = ColumnDataSource(data=....)

  btn = Button(...)
  cb = CustomJS(args=dict(source=source), code='''
  // get user field entries
  $.ajax(
    params: your_params,
    url: django_json_response_view_url, // can be rendered by

template
success: result
source.data = result
)
‘’’)
btn.callback = btn

“”"

raffs
···

On 2017-11-15 17:19, wrote:

[email protected]

Hi Raffs,

Thanks for your response.

        Do not use the bokeh

server! To be honest, I never used bokeh-server with django.

        Why not solve all your problems with the powerful

CustomJS-possibilities?

      I was thinking that using separate processes for django and

bokeh server could make the site perform better (django can
serve request when bokeh is loading data for graphs). The repo also used the bokeh server.

      Basically I could also write the CustomJS. I am just trying

to find the “best practices” to work with django and bokeh in
an application, which involves loading (and possibly saving)
data to/from bokeh plots using the same database as django is
using. A quick grep-search through the files in the repo tells that there are zero
occurences of the word “CustomJS”.

– Niko

  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/8340181c-1eea-4a81-97a6-090b267db232%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/8340181c-1eea-4a81-97a6-090b267db232%40continuum.io?utm_medium=email&utm_source=footer).

  For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

All that are great discussions.

Thanks for the work !

···

On Wed, Nov 15, 2017 at 5:38 PM, Web Busino [email protected] wrote:

Niko,

  One example for CustomJS is. You can load data via ajax and fill

in a DataSource of the bokeh plot.

  Pseudo code

  """
  src = ColumnDataSource(data=....)

  btn = Button(...)
  cb = CustomJS(args=dict(source=source), code='''

  // get user field entries

  $.ajax(

    params: your_params,

    url: django_json_response_view_url, // can be rendered by

template

    success: result

       source.data = result

  )

  ''')

  btn.callback = btn

“”"

raffs

On 2017-11-15 17:19, [email protected]
wrote:

Hi Raffs,

Thanks for your response.

        Do not use the bokeh

server! To be honest, I never used bokeh-server with django.

        Why not solve all your problems with the powerful

CustomJS-possibilities?

      I was thinking that using separate processes for django and

bokeh server could make the site perform better (django can
serve request when bokeh is loading data for graphs). The repo also used the bokeh server.

      Basically I could also write the CustomJS. I am just trying

to find the “best practices” to work with django and bokeh in
an application, which involves loading (and possibly saving)
data to/from bokeh plots using the same database as django is
using. A quick grep-search through the files in the repo tells that there are zero
occurences of the word “CustomJS”.

– Niko

  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/8340181c-1eea-4a81-97a6-090b267db232%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/8340181c-1eea-4a81-97a6-090b267db232%40continuum.io?utm_medium=email&utm_source=footer).

  For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout).

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/3819c1f6-130f-7afc-2469-8095bf925804%40busino.ch.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.