-
Notifications
You must be signed in to change notification settings - Fork 0
Deploying the project on a GCP VM
Once you have this project running on your local machine, you may want to deploy it so that it is available on the internet for anyone to use!
Things can be a little bit complicated when you first try to deploy the project. Follow the steps below:
From the main menu of GCP, choose "VPC network". The steps below are all on this page.
Click on "External IP addresses". Change the type of IP address of your project to "Static" so that it does not change every time you restart your VM.
Since we are using a Flask app, we need more firewall rules to allow traffic on HTTP (port 80), HTTPS (port 443), and Flask apps (port 5000). Add the following firewall rules.
Your VM should by default has a default internet gateway (with the generic destination IP range of 0.0.0.0/0). If not, add one.
Once you have finished all the steps above, you can run the Flask app with the following command (note the host flag):
FLASK_APP=app.py flask run --host=0.0.0.0
Your webpage is now available at the external IP address in step 1 above, at port 5000!