Hi everyone,
I created a Bokeh Application similar to the example on github.
from jinja2 import Template
from tornado.web import RequestHandler
from bokeh.embed import server_document
from bokeh.server.server import Server
…
TEMPLATE =
‘’’
<html lang="en">
<head><title>Title</title></head>
<body>
<div class="centerDiv">
<img src="<path_to_image>")}}" height="300" width="666" class="centerImage">
<img src="{{url_for("static", filename="<image_name>")}}" height="300" width="666" class="centerImage">
</div>
<div class="bk-root">
{{ script | safe }}
</div>
</body>
'''
class IndexHandler(RequestHandler):
def get(self):
template = Template(TEMPLATE)
script = server_document(‘http://localhost:5006/bkapp’)
self.write(template.render(script=script, template=“Tornado”))
def _modify_doc(doc):
add_diagrams(doc)
def start_server():
server = Server({’/bkapp’: _modify_doc}, num_procs=4, extra_patterns=[(’/’, IndexHandler)], allow_websocket_origin=ALLOW_WEB_SOCKET_ORIGIN, port=PORT)
server.start()
server.io_loop.start()
…
``
I want now to include images on the webpage, but both methods from above don’t work. It’s there a way to use url_for, for example by setting a path to a static folder or are there some other solutions?
Thanks!
Hannes