Reputation: 103
I'm trying out compute engine and I've successfully setup a vm, created a flask app as an API that accepts POST requests so I can further send emails to clients, I keep getting a connection refused error whenever I try to make an http post request to the instace IP, I've tried using external and internal IPs, setting up a new firewall rule to allow all ports IN VPC network rules and still nothing. what could be the problem?
this is the address shown to me by my flask app, and this is my client side code for the request.
also i want to note that the code works perfectly on my local machine.
Upvotes: 0
Views: 105
Reputation: 3220
As for Flask 2.2, the development server always shows this warning, it is not possible to disable it. The development server is not intended for use in production. It is not designed to be particularly efficient, stable, or secure. Use a production WSGI server instead. See the deployment docs from Flask for more information.
That warning applies to the development server, not Flask itself. The Flask framework is appropriate for any type of application and deployment.
You can also try running below commands to do flask run
$ export FLASK_APP=hello.py
$ export FLASK_ENV=development
$ flask run
Alternatively you can do the following
$ export FLASK_APP=hello.py
$ python -m flask run
Refer to this SO link for more information.
Upvotes: 1