I use the code below with bokeh==2.3.3 to insert an image in a Div widget (both for macOS and Windows). When upgrading to bokeh >=2.4.0 (I also checked 3.2.2), the test_image.png is still displayed with macOS, but with Windows I get the error
404 GET /test/static/images/test_image.png (::1) 1.00ms
What has to be changed in the code for Windows using bokeh>=2.4.0? I have already checked the changelog and migration guide for bokeh==2.4.0, but was not successful with solving the problem…
Thanks a lot for your support!
from tornado.web import StaticFileHandler
from tornado.ioloop import IOLoop
from bokeh.server.server import Server
from bokeh.models import Div
import os, sys
def make_document(doc):
d = Div(text="""<img src="./test/static/images/test_image.png" alt="div_image">""")
doc.add_root(d)
io_loop = IOLoop.current()
if sys.platform == "win32":
# Windows
path = os.path.normpath(os.path.dirname(os.path.abspath(__file__)) + r'/static/images')
else:
# MacOS
path = r'./static/images'
server = Server(applications={'/test': make_document}, io_loop=io_loop, port=5001,
extra_patterns=[(r'/test/static/images/(.*)', StaticFileHandler, {'path': path})])
server.start()
server.show('/test')
io_loop.start()

