I have hosted a python flask web application on azure virtual machine (Windows OS). When I start the python application, it gets hosted on 127.0.01:5000 i.e. localhost. I can access this in browser by providing localhost:5000 in URL. I want to access this from outside the VM machine. The problem here is Azure VMs have an internal IP and external IP.
I tried to use the external VM IP as parameter in app.run() but it throwing error and not able to host it on external IP.
app.run(HOST = “external Azure VM IP”)
It is throwing below error when trying to host on external IP.
"Error : s.bind(get_sockaddr(hostname, port, address_family))
OSError: [WinError 10049] The requested address is not valid in its context"
Is there any way I can make it work?
Also, I tried hosting it on azure web app services and I was successfully able to host there but I am not able to install external libraries like (beautifulsoup4) into flask application hosted on Azure App Services.
Copyright License:
Author:「Devesh Tiwari」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/54476819/accessing-python-application-hosted-on-azure-vm-windows-os-from-outside