After Google Cloud Shell is launched, you can proceed with the rest
of this tutorial and execute your commands within Cloud Shell.

App Engine locations

App Engine is regional, which means the infrastructure that runs your apps is
located in a specific region and is managed by Google to be redundantly
available across all the zones within that
region.

Meeting your latency, availability, or durability requirements are primary
factors for selecting the region where your apps are run. You can generally
select the region nearest to your app's users but you should consider the
location of the other GCP products and
services that are used by your app. Using
services across multiple locations can affect your app's latency as well as
pricing.

App Engine is available in the following regions:

northamerica-northeast1 (Montréal)

us-central (Iowa)

us-east1 (South Carolina)

us-east4 (Northern Virginia)

southamerica-east1 (São Paulo) *

europe-west (Belgium)

europe-west2 (London)

europe-west3 (Frankfurt)

asia-northeast1 (Tokyo)

asia-south1 (Mumbai)

australia-southeast1 (Sydney)

* For customers using the São Paulo region, all regional product SLAs
remain in force. However, multi-region and cross-region functionality that
span across North America and South America might temporarily have reduced
availability or performance.

You cannot change an app's region after you set it.

If you already created an App Engine application, you can view the
region by running the gcloud app describe command or opening the
App Engine Dashboard in the GCP Console.
The region of your App Engine application is listed under
http://[YOUR_PROJECT_ID].appspot.com.

Download the Hello World app

We've created a simple Hello World app for Python so you can quickly
get a feel for deploying an app to the App Engine flexible environment.
Follow these steps from a command line to download Hello World to your local
machine.

Note: If you are using Cloud Shell, in the toolbar, click
Web Preview and
select Preview on port 8080 instead.

Windows

If you have installed the Google Cloud SDK, you should already have Python 2.7
installed, typically in C:\python27_x64\ (for 64-bit systems). We'll be
invoking the installation of Python packages by using Powershell.

See the following sections for information about cleaning up as well as links to
the possible next steps that you can take.

Clean up

To avoid incurring charges, you can delete your GCP project to stop
billing for all the resources used within that project.

Warning: Deleting a project has the following
consequences:

If you used an existing project, you'll also delete
any other work you've done in the project.

You can't reuse the project ID of a deleted project.
If you created a custom project ID that you plan to use in
the future, delete the resources inside the project instead.
This step ensures that URLs that use the project ID, such
as an appspot.com URL, remain available.

In the project list, select the project you
want to delete and click Delete project.

In the dialog, type the project ID, and then click
Shut down to delete the project.

What's next

Now that you've accomplished Hello World, you can start exploring your next
sample app: the Bookshelf app. The Bookshelf app is a more complete, yet still
basic Python web app that uses multiple Cloud Platform features, such as data
storage, authentication, logging, pub/sub, and more.

Hello World code review

Hello World is the simplest possible App Engine app, as it contains only one
service, has only one version, and all of the code is located within the app's
root directory. This section describes each of the app files in detail.

Here,
app.yaml specifies the runtime used by
the app, and sets env: flex, specifying that the app
uses the flexible environment.

The entrypoint tells App Engine how to start the app. This app uses
gunicorn to serve
the Python application. The $PORT variable is set by App Engine when it starts
the app. For more information about entrypoint, see Application
Startup.
Note: This is the simplest way to get gunicorn running. However this approach
runs the application with a single blocking worker, which means all HTTP requests
are handled in serial, including health checks. In practice, this results in
the application becoming unresponsive in the event of slow requests. For more
details on how to configure gunicorn for production, see
Recommended Gunicorn Configuration

Additionally, the optional runtime_config section sets python_version to use
Python 3. If python_version is not specified, then Python 2 is used by
default. You can also specify python_version: 2 explicitly.