Python 2 is no longer supported by the community. We recommend that you migrate Python 2 apps to Python 3.

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.

  • 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 fields that are no longer supported and update other fields as described in the following table.

Field Change type Description
No longer supported Not applicable in the Python 3 runtime.
threadsafe No longer supported 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.
libraries No longer supported Use the requirements.txt file to declare dependencies and install client libraries.
handlers: login No longer supported The login field is not supported. Use Identity and Access Management (IAM) for user management.
handlers: script Modified In the Python 2 runtime, you use the script field to route incoming requests to your app's script.

In the Python 3 runtime, you are required to use a web framework with in-app routing (such as Flask or Django) instead of using the script field.

To migrate your app.yaml file to the Python 3 runtime, do one of the following, depending on whether the file contains static handlers as well as script handlers:

  • If your app.yaml file contains static handlers, do one of the following to ensure that requests for dynamic content are routed to your app's script:
    • Remove all script fields. Then add an entrypoint field to start a web server that runs your app. Requests that don't match any of your static handers will be directed to the web server you specified in the entrypoint field. The web server and your app's web framework are responsible for routing the request to the correct script.
    • Replace the value of all script fields with auto. App Engine will automatically run your app in a web server (assuming your app meets a few requirements), and all requests that match a script handler will be directed to the web server. The web server and your app's web framework are responsible for routing the request to the correct script.
    • If your app.yaml file does not contain static handlers, remove all script fields. All requests to your app will be directed to your app's web server, and your app's framework will route the request to the correct script. You can optionally add an entrypoint field to customize the default startup behavior.

Static file handling remains unchanged.

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


The Python 2 runtime in the App Engine standard environment used the file include vendored third-party libraries. The Python 3 runtime ignores the 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.