☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Empty page when Flask configured to localhost

Community Support
Gopi_M
Gopi_M

Hi, I have a bokeh app which i am trying to render thru Flask. Bokeh and Flask are installed on Ubuntu VM (on AWS, just in case that matters). The below code works only if i replace localhost:5006/env with the public.ip:5006/env. If i change the url in the below code to locahost:5006/env i get a blank page (at my.public.ip:5000).

from bokeh.resources import CDN

from flask import Flask, render_template
from bokeh.embed import server_document,server_session
from bokeh.client import pull_session

app = Flask(name)

@app.route(“/”)

def index():
myurl = “http://localhost:5006/env”
bokeh_script = server_document(myurl)
return render_template(“index.html”,bokeh_script=bokeh_script)

#run the app
if name == “main”:
app.run(host=‘0.0.0.0’) #app.run(debug=True)

Any idea why this is happening? What could be the fix for it? I am trying not to hardcode the public IP in my code.

⌁   Link to post
Bryan
Bryan

Just to expand on @nghenzi comment: the value of myurl is sent the browser, and the browser attempts to embed the app from that URL. If the Bokeh server is not on the same machine as the browser, then localhost cannot ever work (the browser will try to connect to a Bokeh server on the same machine, and that is not where the Bokeh server is running).

So, TLDR; you will have to configure a either a public IP address, or a valid domain name that points to the machine where the Bokeh server is running.

⌁   Link to post

End of archived discussion · Replies are disabled