I built a dash application on a raspberry pi that run on my local network perfectly fine. I can access it from any computer using the IP of my raspberry pi and port 8050.
I would like to open port on my router to make the app accessible from the WAN but I can’t get it to work.
My first idea was that I just needed to redirect http request on the port 80 of my Livebox to the port 8050 of the raspberry, using the NAT rules… but it looks like it is not that simple.
After looking a bit on the net, it seems the only way to have your dash app be accessible from the WAN is to setup a server on my raspberry pi (Apache server for example). But I don’t understand why I would need to add an apache server to my raspberry pi, when the app is already working in the local network… What does the Apache server do ?
I couldn’t find a proper tutorial on how to set all of that up (Using any kind of server, Apache nginx ect…), if anyone have some ressource about the topic it would be much appreciated.
And if it is possible to do so without having a web server, please let me know.
I have deployed and maintained a Dash application on a Raspberry Pi for the better part of this year, so I may be able to help, at least in part.
If you want to serve content properly, then you really should deploy your Dash app as a background service using Gunicorn (or something comparable, but I’m using Gunicorn). Naturally, you’ll need to use Nginx on top of this service so users can be properly directed to your application. So for a quick summary, Nginx allows people to find your server (associates domain name with IP and port), and Gunicorn is what is serving your application. The part I can’t help you with is port-forwarding, which is probably something you will have to configure with your router (it is a DNS issue). In any case, if you want your website exposed to the world, then setting up a proper server will also make your application more secure. Lastly, you’ll need to purchase a domain name or get one for free somewhere before you can expose your application to the web.
For getting starting with Gunicorn/Nginx, I have found this tutorial by Brandon Wallace to be quite helpful, but Digital Ocean also has a great tutorial.
Thank you your answer, I took a look at the ressource you provided and did some additional search about Gunicorn and I think I have all I need to deploy the app on the WAN. There are plenty of tutorial for port-forwarding so I think I’ll be fine with that part.