(1) From your machine with Google Cloud SDK installed and configured
## Create the project to host your app
c:\home\bin\gcloud>gcloud projects create myfaqbase-gae-002 --name=myfaqbase-gae-002 Create in progress for [https://cloudresourcemanager.googleapis.com/v1/projects/myfaqbase-gae-002].
Waiting for [operations/cp.8891267884033889765] to finish...done.
Enabling service [cloudapis.googleapis.com] on project [myfaqbase-gae-002]...
Operation "operations/acat.p2-216586345359-4068de65-259c-4077-978c-dbdb69248da8" finished successfully.
## Set this new project as your active project
c:\home\bin\gcloud>gcloud config set project myfaqbase-gae-002 Updated property [core/project].
## Confirm
c:\home\bin\gcloud>gcloud config list project [core]
project = myfaqbase-gae-002
Your active configuration is: [default]
## Find out your billing account using the gcloud beta billing command, if prompted to install gcloud beta commands, accept it
## The actual billing account_id have been masked out in the output below
c:\home\bin\gcloud>gcloud beta billing accounts list ACCOUNT_ID NAME OPEN MASTER_ACCOUNT_ID XXXXXX-XXXXXX-XXXXXX Billing Account for XXXXXXXXXXXXXXX True
## Link the newly created project to that billing account, use the ACCOUNT_ID value from the above command output
c:\home\bin\gcloud\myfaqbase-gae-002\python-docs-samples\appengine\standard_python3\hello_world>dir Volume in drive C has no label.
Volume Serial Number is 5A42-6539
Directory of c:\home\bin\gcloud\myfaqbase-gae-002\python-docs-samples\appengine\standard_python3\hello_world
04/02/2022 11:27 am <DIR> .
04/02/2022 11:27 am <DIR> ..
04/02/2022 11:27 am 18 app.yaml
04/02/2022 11:27 am 1,178 main.py
04/02/2022 11:27 am 801 main_test.py
04/02/2022 11:27 am 14 requirements-test.txt
04/02/2022 11:27 am 13 requirements.txt
5 File(s) 2,024 bytes
2 Dir(s) 269,245,865,984 bytes free
c:\home\bin\gcloud\myfaqbase-gae-002\python-docs-samples\appengine\standard_python3\hello_world>type main.py # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# [START gae_python38_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__)
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_python38_app]
## Create the app engine app for this project and select the region to hosts the app engine resources
c:\home\bin\gcloud\myfaqbase-gae-002\python-docs-samples\appengine\standard_python3\hello_world>gcloud app create --proj
ect=myfaqbase-gae-002 --region=asia-southeast1 You are creating an app for project [myfaqbase-gae-002].
WARNING: Creating an App Engine application for a project is irreversible and the region
cannot be changed. More information about regions is at
<https://cloud.google.com/appengine/docs/locations>.
Creating App Engine application in project [myfaqbase-gae-002] and region [asia-southeast1]....done.
Success! The app is now created. Please use `gcloud app deploy` to deploy your first app.
## Deploy the app, type Y when prompted to continue
c:\home\bin\gcloud\myfaqbase-gae-002\python-docs-samples\appengine\standard_python3\hello_world>gcloud app deploy Services to deploy:
Beginning deployment of service [default]...
Created .gcloudignore file. See `gcloud topic gcloudignore` for details.
#============================================================#
#= Uploading 5 files to Google Cloud Storage =#
#============================================================#
File upload done.
Updating service [default]...done.
Setting traffic split for service [default]...done.
Deployed service [default] to [https://myfaqbase-gae-002.as.r.appspot.com]
You can stream logs from the command line by running:
$ gcloud app logs tail -s default
To view your application in the web browser run:
$ gcloud app browse
## Browse your app
c:\home\bin\gcloud\myfaqbase-gae-002\python-docs-samples\appengine\standard_python3\hello_world>gcloud app browse
Opening [https://myfaqbase-gae-002.as.r.appspot.com] in a new tab in your default browser.
Clean up
## If you want to clean up, disable the app in Cloud console