Accessing Linux web applications from Windows
If you are developing a web application, then you typically have your application open in your web browser as http://localhost
while you are working on it. With WSL, your web application is running inside the WSL lightweight virtual machine, which has a separate IP address (you can find this with the Linux ip addr
command). Fortunately, WSL forwards localhost addresses to Linux distros to preserve the natural workflow. You'll work through that in this section.
To follow along with this, make sure that you have the code for the book cloned in a Linux distro, open a terminal, and navigate to the chapter-04/web-app
folder at https://github.com/PacktPublishing/Windows-Subsystem-for-Linux-2-WSL-2-Tips-Tricks-and-Techniques/tree/main/chapter-04.
The sample code uses Python 3, which should already be installed if you are using a recent version of Ubuntu. You can test whether Python 3 is installed by running python3 -c 'print("...