Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access a Plotly-Dash app server via LAN

Tags:

plotly-dash

I have a Plotly-Dash app which is running perfectly fine under localhost:8050 or 127.0.0.1:8050.

Question is: how can I access this app server from another computer in the same LAN?

So far, I've tried to access http://x.y.z.w/8050 with x.y.z.w being the LAN IP address of the server (ping goes ok). All I get is:

This site can’t be reached
x.y.z.w refused to connect.

Same when I try to access the server from the server computer itself, but using LAN IP instead of localhost or 127.0.0.1. ping is fine.


On a note, the server computer (my laptop) is connected to the company network via VPN, but I don't think this would change anything, since that's the whole purpose of VPN. Then I remote desktop to a computer at the office and try to access back my server.

like image 426
Raf Avatar asked May 08 '20 11:05

Raf


2 Answers

I think your app.py currently should have something like:

if __name__ == '__main__':
   app.run_server(debug=False)

Try replacing this with app.run_server(host= '0.0.0.0',debug=False) Now on the LAN browser, you should be able to access with the ip address of the server that you are running the dash app.

Also, you may want to check which port is used by this server for broadcast.

like image 194
Syamanthaka Avatar answered Sep 25 '22 17:09

Syamanthaka


Unless you specify host='0.0.0.0 your application server would only listen to 127.0.0.1 which is localhost. When you specify 0.0.0.0 it means listen on all computer interfaces including your LAN one.

If you need share an application running on your local laptop externally over the internet and restrict access to just specific individuals, check out this sample project and tutorial

like image 44
DenisM Avatar answered Sep 23 '22 17:09

DenisM