Preparing configuration files for the Python 3 runtime

Before you can run your app in the Python 3 runtime of the App Engine standard environment, you may need to change some of the configuration files that App Engine uses:

  • app.yaml. This file contains information about your app's code, such as the runtime and the latest version identifier.

  • appengine_config.py. The Python 2 runtime uses this file to install client libraries and provide values for constants and "hook functions". The Python 3 runtime doesn't use this file.

Updating app.yaml

The behavior of some fields in your app.yaml configuration file has been modified. Remove any deprecated fields and update other fields as described in the following table.

Field Change type Description
entrypoint Added entrypoint is a new optional field for specifying the command that runs when your app starts. If you do not specify an entrypoint, App Engine configures and starts the Gunicorn web server.
threadsafe Deprecated All applications are presumed to be threadsafe. If your application isn't threadsafe, set max_concurrent_requests to 1. This may significantly increase your costs.
api_version Deprecated No longer used in the Python 3 runtime.
builtins Deprecated
libraries Deprecated Use the requirements.txt file to declare dependencies and install client libraries.
handlers Modified
  • In the Python 2 runtime, the script field specifies an app to run when a specific URL or URL pattern is requested.

    In the Python 3 runtime, your app needs to use a web framework such as Flask or Django to route requests for dynamic content instead of using the script field. To specify the command that starts your app, use the entrypoint field.

    To route requests for static content, create URL handlers in your app's app.yaml file.

  • The login field is not supported. Use Cloud Identity and Access Management for user management.

If you use any of the deprecated fields, App Engine returns an error when you deploy your app.

Removing appengine_config.py

The Python 2 runtime in the App Engine standard environment used the appengine_config.py file include vendored third-party libraries. The Python 3 runtime ignores the appengine_config.py file.

Instead, the Python 3 runtime uses the standard requirements.txt file to install dependencies, including dependencies that use native code. For more information, see Specifying Dependencies in the Python 3 runtime.

Was this page helpful? Let us know how we did:

Send feedback about...

App Engine standard environment for Python 2