Dash: Open dash app on specified address

Created on 30 Aug 2017  路  7Comments  路  Source: plotly/dash

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

Most helpful comment

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')

All 7 comments

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

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

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

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')

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

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jerry-Ma picture Jerry-Ma  路  3Comments

germayneng picture germayneng  路  4Comments

Mondrik picture Mondrik  路  3Comments

hscspring picture hscspring  路  4Comments

T4rk1n picture T4rk1n  路  3Comments