Hey there!
This codelab will walk you through the process of creating a simple "Hello World" application using Python Flask and deploying it to Google Cloud Run.
In order to follow this codelab, you'll need the following:
project-x
.Follow the official guide to install the Google Cloud CLI: Installing Google Cloud SDK.
mkdir hello-world-cloud-run
cd hello-world-cloud-run
python3 -m venv .venv
source .venv/bin/activate
pip install Flask
main.py
with the following content:from flask import Flask
import os
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
if __name__ == '__main__':
app.run(debug=True, host="0.0.0.0", port=int(os.environ.get("PORT", 8080)))
python main.py
http://localhost:8080
. You should see the "Hello, World!" message.pip list --format=freeze > requirements.txt
gcloud run deploy
Congratulations! You've just built and deployed a simple application on Google Cloud Run using Python and Flask!