Add image to bokeh server apps and problem with responsive app

I would like to add image in my bokeh server application running python file. On local machine my image is shown with absolute path (e.g. C:\Myapp\logo.jpg). But when I apply on server machine the image is not shown (servername\Myapp\logo.jpg).

My question is what is the root for image. I copy the logo file in the same folder as .py code and also in the subfolder named logo and changed the path, but the image is not shown in the div, neither together with the title (e.g

<img src=…).

Goran

Hi,

By default Bokeh server will look for (and serve) a static subdirectory in directory style apps:

  https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#directory-format

Alternatively, if you embed the Bokeh server as a library:

  Bokeh server — Bokeh 3.3.2 Documentation

then you have access to Tornado directly and can add whatever arbitrary endpoints you like.

Thanks,

Bryan

···

On Jan 2, 2018, at 12:53, Goran Goki <[email protected]> wrote:

I would like to add image in my bokeh server application running python file. On local machine my image is shown with absolute path (e.g. C:\\Myapp\logo.jpg). But when I apply on server machine the image is not shown (servername\Myapp\logo.jpg).

My question is what is the root for image. I copy the logo file in the same folder as .py code and also in the subfolder named logo and changed the path, but the image is not shown in the div, neither together with the title (e.g <h1><img src=....).

Goran

--
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/d55802e2-729e-4992-86e7-a53a7cad7ed3%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

I forgetr the second problem:
My second question is related to responsive widgets and plots.

I use newest bokeh vesrion 0.12.13 and do not use class_names for widgets and plots and sizing mode is 'scale_width

the layout statements:

r1 = row(widgetbox([distribution_RadioGroup, pre, presost, info1]), column([radioButton_Reg, plot, p2, p3]), column([radioButton_group, p]))
r2 = column(row([desc]), r1, sizing_mode=sizing_mode)’

curdoc().add_root(r2)

where distribution_RadioGroup, pre, presost, info1 radioButton_Reg, radioButton_group are widgets and plot, p2, p3 and p are plots

what I missed?

Goran

···

On Tuesday, January 2, 2018 at 7:53:44 PM UTC+1, Goran Goki wrote:

I would like to add image in my bokeh server application running python file. On local machine my image is shown with absolute path (e.g. C:\Myapp\logo.jpg). But when I apply on server machine the image is not shown (servername\Myapp\logo.jpg).

My question is what is the root for image. I copy the logo file in the same folder as .py code and also in the subfolder named logo and changed the path, but the image is not shown in the div, neither together with the title (e.g

<img src=…).

Goran

Thanks,

If I understood well If I run .py file does it mean that the image will be read from static folder?, because I have a problem to run bokeh app in directory format because of the error message “ERROR:‘utf-8’ codec can’t decode byte 0xc0 in position 82: invalid start byte” (I use # -- coding: cp1251 -- (cyrilic) to read jstat data with pyjstat).

Goran

···

On Tuesday, January 2, 2018 at 8:04:27 PM UTC+1, Bryan Van de ven wrote:

Hi,

By default Bokeh server will look for (and serve) a static subdirectory in directory style apps:

    [https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#directory-format](https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#directory-format)

Alternatively, if you embed the Bokeh server as a library:

    [https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#embedding-bokeh-server-as-a-library](https://bokeh.pydata.org/en/latest/docs/user_guide/server.html#embedding-bokeh-server-as-a-library)

then you have access to Tornado directly and can add whatever arbitrary endpoints you like.

Thanks,

Bryan

On Jan 2, 2018, at 12:53, Goran Goki [email protected] wrote:

I would like to add image in my bokeh server application running python file. On local machine my image is shown with absolute path (e.g. C:\Myapp\logo.jpg). But when I apply on server machine the image is not shown (servername\Myapp\logo.jpg).

My question is what is the root for image. I copy the logo file in the same folder as .py code and also in the subfolder named logo and changed the path, but the image is not shown in the div, neither together with the title (e.g

<img src=…).

Goran


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/d55802e2-729e-4992-86e7-a53a7cad7ed3%40continuum.io.

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

Here is an example how to run the bokeh serve with background image and relative path: