Codelabs App Engine
App Engine Example
01 gcloud config list project
02 gcloud config set compute/zone us-central1-f
03 gcloud config set compute/region us-central1
04 mkdir helloworld && cd helloworld
05 nano helloworld.py
06 nano app.yaml
07 nano requirements.txt
08 ls -la
09 gcloud app deploy
10 gcloud app browse
helloworld.py
# [START gae_python37_app]
from flask import Flask
# If `entrypoint` is not defined in app.yaml, App Engine will look for an app
# called `app` in `main.py`.
app = Flask(__name__)
@app.route('/')
def hello():
"""Return a friendly HTTP greeting."""
return 'Hello World!'
if __name__ == '__main__':
# This is used when running locally only. When deploying to Google App
# Engine, a webserver process such as Gunicorn will serve the app. This
# can be configured by adding an `entrypoint` to app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)
# [END gae_python37_app]
app.yaml
runtime: python37
requirements.txt
Flask==1.1.1
No comments:
Post a Comment