[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eThe Python 3 runtime on App Engine standard environment requires updates to the \u003ccode\u003eapp.yaml\u003c/code\u003e file, while the \u003ccode\u003eappengine_config.py\u003c/code\u003e file is no longer used.\u003c/p\u003e\n"],["\u003cp\u003eSeveral fields in the \u003ccode\u003eapp.yaml\u003c/code\u003e file are no longer supported in Python 3, including \u003ccode\u003eapi_version\u003c/code\u003e, \u003ccode\u003eapplication_readable\u003c/code\u003e, \u003ccode\u003ebuiltins\u003c/code\u003e, \u003ccode\u003ethreadsafe\u003c/code\u003e, and \u003ccode\u003elibraries\u003c/code\u003e, each having different changes in requirements or methodology.\u003c/p\u003e\n"],["\u003cp\u003eIf using the legacy bundled services, the \u003ccode\u003eapp_engine_apis\u003c/code\u003e field in \u003ccode\u003eapp.yaml\u003c/code\u003e must be set to \u003ccode\u003etrue\u003c/code\u003e, and it enables the use of \u003ccode\u003ehandlers: login\u003c/code\u003e; otherwise, Identity and Access Management (IAM) should be used.\u003c/p\u003e\n"],["\u003cp\u003eIn Python 3, the \u003ccode\u003escript\u003c/code\u003e field in \u003ccode\u003eapp.yaml\u003c/code\u003e handlers is replaced by in-app routing using a web framework like Flask or Django, and the \u003ccode\u003eentrypoint\u003c/code\u003e field is used to start the web server, which will handle the routing.\u003c/p\u003e\n"],["\u003cp\u003eIn the Python 3 runtime, dependencies are installed using the standard \u003ccode\u003erequirements.txt\u003c/code\u003e file instead of the \u003ccode\u003eappengine_config.py\u003c/code\u003e file used in Python 2, meaning the latter file can be removed.\u003c/p\u003e\n"]]],[],null,["# Preparing configuration files for the Python 3 runtime\n\nBefore you can run your app in the Python 3 runtime of the App Engine standard environment, you\nmay need to change some of the configuration files that App Engine uses:\n\n- `app.yaml`. This file contains information about your app's code, such as the\n runtime and the app handlers.\n\n- `appengine_config.py`. The Python 2 runtime uses this file to access\n third-party libraries and provide values for constants and \"hook functions\".\n The Python 3 runtime doesn't use this file.\n\nUpdating `app.yaml`\n-------------------\n\nThe behavior of some fields in your\n[`app.yaml` configuration file](/appengine/docs/standard/reference/app-yaml#entrypoint)\nhas been modified. Remove any fields that are no longer supported and update\nother fields as described in the following table.\n\nIf you use any of the deprecated fields, App Engine returns an error\nwhen you deploy your app.\n\nYou can use the following examples to compare the differences between the\n`app.yaml` files: \n\n### Python 2\n\n```yaml\nruntime: python27\napi_version: 1\nthreadsafe: true\n\nhandlers:\n- url: /\n script: home.app\n\n- url: /index\\.html\n script: home.app\n\n- url: /stylesheets\n static_dir: stylesheets\n\n- url: /(.*\\.(gif|png|jpg))$\n static_files: static/\\1\n upload: static/.*\\.(gif|png|jpg)$\n\n- url: /admin/.*\n script: admin.app\n login: admin\n\n- url: /.*\n script: not_found.app\n```\n\n### Python 3\n\n runtime: python313\n app_engine_apis: true\n\n handlers:\n - url: /stylesheets\n static_dir: stylesheets\n\n - url: /(.*\\.(gif|png|jpg))$\n static_files: static/\\1\n upload: static/.*\\.(gif|png|jpg)$\n\n - url: /admin/.*\n script: auto\n login: admin\n\n| **Note:** For Python 3 the preferred WSGI-compatible web server is `gunicorn`. When you use the optional `entrypoint` field in your [`app.yaml`](/appengine/docs/standard/reference/app-yaml#runtime_and_app_elements) configuration file, the timeout for `gunicorn` defaults to 30 seconds. To set a custom timeout, update the `entrypoint` field: for example, `entrypoint: gunicorn -b :$PORT --timeout=600`. In this case, [make sure you\n| have included `gunicorn`](/appengine/docs/standard/python3/runtime#entrypoint_best_practices) in your `requirements.txt` file.\n\nRemoving `appengine_config.py`\n------------------------------\n\nThe Python 2 runtime in the App Engine standard environment uses the\n[`appengine_config.py`](/appengine/docs/legacy/standard/python/tools/using-libraries-python-27)\nfile.\n\nThis file is ignored in the Python 3 runtime. Instead, the Python 3 runtime\nuses the standard `requirements.txt` file to\n[install dependencies](/appengine/docs/standard/python3/specifying-dependencies),\nincluding dependencies that use native code."]]