Accessing dash webserver from hosts other than localhost

Is the webserver limited to GET requests from localhost only? I’d like to be able to view plots from machines other than the host the webserver is running on.

Thank you.

I should have done some more research first.
app.run(host= ‘0.0.0.0’)
to make flask an Externally Visible Server

4 Likes

I have published an official deployment guide here: https://plot.ly/dash/deployment.

I am trying to have access to my dash app from other computer using app.run(host= ‘0.0.0.0’). Unfortunately the web page is not accessible. Is there any other setup must be done?
I have some questions if someone could help me out:
1- Let’s say I running the app from my local host, do computers connected to same local network (intranet) must have Python and all librairies installed.
2- If someone wants to connect from the machine other than the host webserver is running on, must he run the python script every time he wants to open the page?

Thank you!

have you specified the port with the host?

The “viewer” computer needs only browser (python is not required)

The “server” computer is where your code runs needs python (obv)

Hi Max thank you for your answer, Actually the ‘server’ computer has Python installed (my computer).

What do you mean ‘have you specified the port with the host?’, I gave the host adresse which is http://127.0.0.1:8050/ to the view computer but it says can’t access to the webpage.

Do you mind explaining the steps to be able to resolve that, I ll really appreciate.
Here my the top and bottom of my code:

#all imports are here

app = dash.Dash(name)

server = app.server

…Code here for my app…

app.css.append_css({
‘external_url’: ‘https://codepen.io/chriddyp/pen/bWLwgP.css
})

if name == ‘main’:
app.run_server(debug = True,host = ‘0.0.0.0’).

Thank you !

I think you will have to assign the port like this

app.run_server(debug=False, host='0.0.0.0', port = 8080)

(Debug wont matter. But you will need host and port. Try the open 8080 port on your LAN/WAN. Otherwise you might have to look into your firewall to allow port 8050 open for local network (Just a guess so take it with a grain of salt)

2 Likes

@vince, the IP address of 127.0.0.1 will resolve to the local host; so if that is what you’re trying to visit in a browser on the ‘viewer’ computer it won’t be trying to reach the ‘server’ computer. You need to replace 127.0.0.1 with a valid address for the ‘server’ computer.

Running the command ifconfig (or the windows equivalent) on the server machine will tell you what IP addresses that machine is using.

1 Like

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

Thank you guys for your answers, sorry for the late reply, actually rebuild my whole app on R-Shiny whch I feel more comfortable and easier to use, however I faced the same problem.
So guys you were right is a firewall obstruction, Problem resolved now!
Thanks

I also have an easy fix for more straight forward deployments:

import socket
host = socket.gethostbyname(socket.gethostname())
app.run_server(debug=[True or False], host=host, port = [any valid 4 digit number])

Sushant I got the same error Using Ngrok. Did you could solve it?

Check out this tutorial

  • app runs securely inside Docker container
  • only designated users can access it (restrict by email addresses)
  • secure HTTPS tunnel accessible from the internet

this works for me!! to acess to other host just put in browser yourip:port, for example, 194.85.78.14:8080

host= ‘0.0.0.0’