Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Une application App Engine est configurée à l'aide d'un fichier app.yaml contenant les ressources (processeur, mémoire, réseau et disque), le scaling, ainsi que d'autres paramètres généraux tels que les variables d'environnement.
À propos des fichiers app.yaml
Vous pouvez spécifier la configuration de l'environnement d'exécution de votre application Python, y compris les versions et les URL, dans le fichier app.yaml. Ce dernier sert de descripteur de déploiement pour une version de service spécifique.
Vous devez d'abord créer le fichier app.yaml pour le service default de votre application avant de pouvoir créer et déployer des fichiers app.yaml pour des services supplémentaires dans l'application.
Le fichier app.yaml suivant montre comment configurer votre application pour qu'elle utilise la dernière version de Python. Pour utiliser toute autre version compatible de Python, vous devez mettre à jour votre fichier app.yaml. Pour en savoir plus, consultez la section Environnement d'exécution Python.
# Copyright 2021 Google LLC## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.runtime:pythonenv:flexentrypoint:gunicorn -b :$PORT main:appruntime_config:operating_system:ubuntu22# This sample incurs costs to run on the App Engine flexible environment.# The settings below are to reduce costs during testing and are not appropriate# for production use. For more information, see:# https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yamlmanual_scaling:instances:1resources:cpu:1memory_gb:0.5disk_size_gb:10
Selon la complexité du service de votre application, il vous suffira peut-être de définir quelques éléments dans le fichier app.yaml correspondant. L'exemple suivant montre ce qu'une application Python simple peut nécessiter dans un environnement flexible :
Vous pouvez spécifier un nom unique pour les fichiers app.yaml. Toutefois, dans ce cas, vous devez également spécifier ce nom de fichier dans la commande de déploiement. Par exemple, si vous nommez votre fichier app.yaml "service-name-app.yaml" ou "app.flexible.yaml", vous devez déployer votre application à l'aide de l'une des commandes suivantes :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eApp Engine apps are configured using an \u003ccode\u003eapp.yaml\u003c/code\u003e file, which defines CPU, memory, network, disk resources, scaling, environment variables, and general settings.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eapp.yaml\u003c/code\u003e file specifies the runtime configuration for a Python app, including versions and URLs, and it serves as a deployment descriptor for a specific service version.\u003c/p\u003e\n"],["\u003cp\u003eYou must create an \u003ccode\u003eapp.yaml\u003c/code\u003e file for the \u003ccode\u003edefault\u003c/code\u003e service before creating and deploying \u003ccode\u003eapp.yaml\u003c/code\u003e files for additional services.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eapp.yaml\u003c/code\u003e file can be named uniquely, but the file name must then be specified with the deployment command, such as \u003ccode\u003egcloud app deploy service-name-app.yaml\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eSome Python runtimes have reached their end of support, so it's recommended to upgrade your app to use the latest version of Python in the \u003ccode\u003eapp.yaml\u003c/code\u003e file.\u003c/p\u003e\n"]]],[],null,["# Configuring your app with app.yaml\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n| **Note:** Some [Python runtimes](/appengine/docs/flexible/lifecycle/support-schedule#python) have reached [end of support](/appengine/docs/flexible/lifecycle/runtime-lifecycle#end_of_support). You cannot re-deploy versions that use runtimes after their end of support date. We recommend that you [upgrade your app](/appengine/docs/flexible/python/runtime#newversions) to use the latest version of Python.\n\n\u003cbr /\u003e\n\n\nAn App Engine app is configured using an `app.yaml`\nfile, that contains CPU, memory, network and disk resources, scaling, and other\ngeneral settings including environment variables.\n\n\nAbout `app.yaml` files\n----------------------\n\n\u003cbr /\u003e\n\nYou can specify the runtime configuration for your Python app, including versions and URLs, in the `app.yaml` file. This file acts as a deployment descriptor of a specific [service](/appengine/docs/flexible/an-overview-of-app-engine) version.\n\n\u003cbr /\u003e\n\n\nYou must first create the `app.yaml` file for the `default` service of your app\nbefore you can create and deploy `app.yaml` files for additional services.\n\n\nThe following `app.yaml` demonstrates how to configure your app to use\nthe latest version of Python. To use any other [supported version](/appengine/docs/flexible/lifecycle/support-schedule#python) of Python,\nyou must update your `app.yaml` file. For more information, see\n[Python runtime](/appengine/docs/flexible/python/runtime). \n\n # Copyright 2021 Google LLC\n #\n # Licensed under the Apache License, Version 2.0 (the \"License\");\n # you may not use this file except in compliance with the License.\n # You may obtain a copy of the License at\n #\n # http://www.apache.org/licenses/LICENSE-2.0\n #\n # Unless required by applicable law or agreed to in writing, software\n # distributed under the License is distributed on an \"AS IS\" BASIS,\n # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n # See the License for the specific language governing permissions and\n # limitations under the License.\n\n runtime: python\n env: flex\n entrypoint: gunicorn -b :$PORT main:app\n\n runtime_config:\n operating_system: ubuntu22\n\n # This sample incurs costs to run on the App Engine flexible environment.\n # The settings below are to reduce costs during testing and are not appropriate\n # for production use. For more information, see:\n # https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yaml\n manual_scaling:\n instances: 1\n resources:\n cpu: 1\n memory_gb: 0.5\n disk_size_gb: 10\n\n\nDepending on the complexity of your app's service, you might only need to define\na few elements in the corresponding `app.yaml` file. The following example\ndemonstrates what a simple Python app might require in the\nflexible environment:\n\n\nYou can specify a unique name for your `app.yaml` files, but then you must\nspecify the file name with the [deployment\ncommand](/appengine/docs/flexible/testing-and-deploying-your-app)\nas well. For example, if you name your `app.yaml` file `service-name-app.yaml`\nor `app.flexible.yaml`, then you must deploy your app using either: \n\n gcloud app deploy service-name-app.yaml\n gcloud app deploy app.flexible.yaml\n\nTo learn more about structuring multiple services and `app.yaml` files in your app, see [Structuring web services](/appengine/docs/flexible/configuration-files).\n\n\u003cbr /\u003e\n\nAll configuration elements\n--------------------------\n\nFor a complete list of all the supported elements in this configuration file,\nsee the\n[`app.yaml` reference](/appengine/docs/flexible/reference/app-yaml)."]]