dash icon indicating copy to clipboard operation
dash copied to clipboard

Open dash app on specified address

Open mayacahana opened this issue 9 years ago • 7 comments

Hi, Is there a way to open the dash app on a specific local address (instead of http://127.0.0.1:8050/ for example)? Thank you

mayacahana avatar Aug 30 '17 14:08 mayacahana

It depends on how you're running the Flask app. If you're using the built-in development server, you can do this at the bottom of your Dash app:

if __name__ == '__main__':
    # change host from the default to '0.0.0.0' to make it publicly available
    talk.app.server.run(port=8000, host='127.0.0.1')

...and then just run eg python app.py

Otherwise you can use a WSGI server such as gunicorn which will allow you to specify the host/port on the command line:

gunicorn --workers 1 --bind 0.0.0.0:8000 app:app.py

ned2 avatar Sep 04 '17 07:09 ned2

Also see plot.ly/dash/deployment/ for more details (and github.com/plotly/dash-docs if you want to update the docs)

chriddyp avatar Sep 04 '17 13:09 chriddyp

ned2, what is the "talk" object you are using? Can you provide more details to your example?

tylermanning avatar Apr 20 '18 14:04 tylermanning

Hmmm I don't actually recall. That's not standard Dash usage. Looks kinda like it's referring to an example where the Dash instance (app) is a property of some other object (talk), but I don't see where that example is mentioned. At any rate it's not relevant to general usage. It should look like:

if __name__ == '__main__':
    # change host from the default to '0.0.0.0' to make it publicly available
    app.server.run(port=8000, host='127.0.0.1')

ned2 avatar Apr 20 '18 16:04 ned2

I came across this thread while trying ti figure how to run Dash app on server other than local. I am using NGROK to make my local server public. The local server get forwarded to this address host='13584e17.ngrok.io' which I'm not able to use in Dash says

OSError: [Errno 99] Cannot assign requested address

This is the forwarded addess using NGROK:

Forwarding https://13584e17.ngrok.io -> 127.0.0.1:8081

fdkssdks avatar Aug 15 '18 14:08 fdkssdks

When using ngrok, you don't change the host information on your Dash app (well, Flask really). You just need to tell ngrok the port that your Dash app is running on, then it does the rest. You then navigate to that host address in the browser.

ned2 avatar Aug 15 '18 14:08 ned2

modify app.py: app.run_server(debug=True,port=8000, host='0.0.0.0') then get your device LAN IP e.,g 192.169.123.0:8000 you will find

host452b avatar Oct 27 '20 03:10 host452b