Auto-open browser window with Dash

Is there a simple way to cause the browser window on the correct port to automagically open (ala jupyter?). I’ve dug around a bit in the source of the jupyter project with no success so far. Bonus points if this can be done while using a more production-ready server (something like a gevent WSGI server example)…

Hi @dhhagan,

Would something using the webbrowser module work?


import dash

import webbrowser
from threading import Timer

app = dash.Dash(__name__) 

port = 5000 # or simply open on the default `8050` port

def open_browser():

if __name__ == '__main__':
    Timer(1, open_browser).start();
    app.run_server(debug=True, port=port)


1 Like

I am running it just as it is suggested here, but when I do two tabs open! Why can this be happening? Any ideas on how to solve it?