question

LammersPeter-0120 avatar image
0 Votes"
LammersPeter-0120 asked LammersPeter-0120 answered

Access Python Flask app running on an Azure VM

I created a simple python app that has a client part that accesses (uses the requests library) another app (web app) using Flask library to get data. Everything works when I run it locally. I put the web app portion on a Windows VM in Azure and then try to 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 as well. 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?

azure-virtual-machines
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LammersPeter-0120 avatar image
0 Votes"
LammersPeter-0120 answered

I spent all day but I figured it out. It was the firewall on the VM itself blocking port 5000.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.