Python 2 런타임에서 script 필드를 사용하여 수신 요청을 앱의 스크립트로 라우팅합니다.
Python 3 런타임에서는 script 필드를 사용하는 대신 인앱 라우팅(예: Flask 또는 Django)이 포함된 웹 프레임워크를 사용해야 합니다.
app.yaml 파일을 Python 3 런타임으로 마이그레이션하려면 파일에 정적 핸들러와 스크립트 핸들러가 있는지 여부에 따라 다음 중 하나를 수행합니다.
app.yaml 파일에 정적 핸들러가 포함된 경우 다음 중 하나를 수행하여 동적 콘텐츠 요청이 앱의 스크립트로 라우팅되도록 합니다.
모든 script 필드를 삭제합니다. 그런 다음 entrypoint 필드를 추가하여 앱을 실행하는 웹 서버를 시작합니다. 정적 핸들러와 일치하지 않는 요청은 entrypoint 필드에 지정된 웹 서버로 전달됩니다. 웹 서버와 앱의 웹 프레임워크는 요청을 올바른 스크립트로 라우팅하는 역할을 합니다.
모든 script 필드의 값을 auto로 바꿉니다. App Engine은 웹 서버에서 앱을 자동으로 실행하며 스크립트 핸들러와 일치하는 모든 요청은 웹 서버로 전달됩니다(앱이몇 가지 요구사항을 충족할 경우). 웹 서버와 앱의 웹 프레임워크는 요청을 올바른 스크립트로 라우팅하는 역할을 합니다.
app.yaml 파일에 정적 핸들러가 포함되어 있지 않은 경우 모든 script 필드를 삭제하세요. 앱에 대한 모든 요청은 앱의 웹 서버로 전달되며 앱의 프레임워크는 요청을 올바른 스크립트로 라우팅합니다. 필요에 따라 entrypoint 필드를 추가하여 기본 시작 동작을 맞춤설정할 수 있습니다.
app.yaml에 두 가지 유형의 핸들러가 모두 있는 경우에 정적 핸들러와 아래 예시의 관리자 전용 핸들러와 같이 다른 지시어가 필요한 auto 핸들러를 제외하고 auto를 표시하는 모든 스크립트 핸들러를 삭제할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\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."]]