The Python 3.7 runtime is the software stack responsible for installing your web service's code and its dependencies and running your service.
The Python 3.7 runtime for App Engine in the standard environment is
declared in the
Python 3 version
The Python 3.7 runtime environment uses the latest stable release of Python 3.7. App Engine automatically updates to new minor revisions upon deployment, but will not automatically update the major version.
For example, your application might be deployed at Python 3.7.0 and later automatically updated to Python 3.7.1, but it will not be automatically updated to Python 3.8.0.
Currently, Python 3.7 is the only Python 3 runtime available on the App Engine standard environment.
During deployment, App Engine uses the Python package manager
pip to install dependencies
defined in the
metadata file located in your project's root directory. You do not need to
upload dependencies as App Engine performs a fresh install.
Dependency specification using the
Pipfile.lock standard is
currently not supported and your project must not have these files present.
The runtime starts your application by using the contents of the optional
entrypoint field in your
app.yaml file. For example:
runtime: python37 entrypoint: gunicorn -b :$PORT main:app
For your app to receive HTTP requests, your entrypoint should start a web server that listens on the port specified by the PORT environment variable.
The use of an entrypoint is optional. If your app meets the following
conditions, App Engine will automatically add a web server to your
requirements.txt file and configure the Gunicorn web server:
The root of your app directory contains a
main.pyfile with a WSGI-compatible object called
app.yamldoes not contain the entrypoint field.
Your app does not contain
Any HTTP requests will cause your application to run using this pre-configured web server.
Entrypoint best practices
Do not include
gunicorn in your
requirements.txt file unless you are
specifying the entrypoint.
For the best performance, the entrypoint should be lightweight because it runs whenever a new instance of your application is created.
If you specify an entrypoint, configure your webserver
according to your chosen instance size
to avoid running out of memory. If you are using Gunicorn,
configure the number of workers using the
Append this flag to your entrypoint with a value that matches your chosen
This guidance serves as a starting point for selecting the number of workers. Depending on your app's performance needs and characteristics, you may need to use more or fewer workers.
The following environment variables are set by the runtime:
||The ID of your App Engine application.|
||The ID of the current deployment.|
||The App Engine environment. Set to
||The ID of the instance on which your service is currently running.|
||The amount of memory available to the application process, in MB.|
||The runtime specified in your
||The service name specified in your
||The current version label of your service.|
||The GCP project ID associated with your application.|
||The port that receives HTTP requests.|
define additional environment variables in your
but the above values cannot be overridden, except for
HTTPS and forwarding proxies
App Engine terminates HTTPS connections at the load balancer and
forwards requests to your application. Some applications need to determine
the original request IP and protocol. The user's IP address is available in
X-Forwarded-For header. Applications that require this
information should configure their web framework to trust the proxy.
The runtime includes a full filesystem. The filesystem is read-only except for
/tmp, which is a virtual disk storing data in your
App Engine instance's RAM.
Each instance of your application can use the App Engine metadata server to query information about the instance and your project.
You can access the metadata server through the following endpoints:
The following table lists the endpoints where you can make HTTP requests for specific metadata:
||The project number assigned to your project.|
||The project ID assigned to your project.|
||The zone the instance is running in.|
||The default service account email assigned to your project.|
||Lists all the default service accounts for your project.|
||Lists all the supported scopes for the default service accounts.|
||Returns the auth token that can be used to authenticate your application to other Google Cloud APIs.|
For example, to retrieve your project ID, send a request to