Python Forum

Full Version: Flask web app on Azure help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I created a simple app that has a client part that accesses (uses requests library) another app (web app) using Flask library to get data. Everything works when I run it locally. I am trying to put the web app portion on a VM in Azure and then access it from the client on my local machine. I added an inbound port rule on the Azure VM to open port 5000. I then updated the client app to use the public IP address of the Azure VM and it uses port 5000. I run the web app and then tried running the client with both HTTP and HTTPS in my Get request:

getproduct = requests.get("https://13.66.191.67:5000/products")

I get this error:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='13.66.191.66', port=5000): Max retries exceeded with url: /products (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000009DF56639D0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'))

Any ideas on what I should check next?
I spent all day but I figured it out. It was the firewall on the VM itself blocking port 5000.
Yes this solution work, but it would be more correct place nginx in front of flask.