Testing and deploying your upgraded app in Python 3
Stay organized with collections
Save and categorize content based on your preferences.
Region ID
The REGION_ID is an abbreviated code that Google assigns
based on the region you select when you create your app. The code does not
correspond to a country or province, even though some region IDs may appear
similar to commonly used country and province codes. For apps created after
February 2020, REGION_ID.r is included in
App Engine URLs. For existing apps created before this date, the
region ID is optional in the URL.
Other Google Cloud services such as Cloud Storage and
Memorystore don't provide emulators.
Testing locally
To test your app's functionality before deploying, follow the instructions for
running locally
in the Python 3 runtime.
Testing on App Engine before shifting traffic
Before routing traffic to your upgraded Python app, deploy the app to the
App Engine Python 3 runtime for another round of testing. For example,
to test your app's default service:
Now you can test your new version in the App Engine runtime
environment. You can debug your application by viewing its logs. For more
information, see Writing Application Logs.
Requests sent to
https://PROJECT_ID.REGION_ID.r.appspot.com
are routed to the version previously configured to receive traffic.
To test new versions of other services, follow the same process, but replace
default in the URL with your service's name:
For more information about targeting specific services and versions, see
How Requests are Routed.
Migrating traffic to your app
When you're ready to send traffic to the new version:
Update environment variables in your app.yaml file to send requests to your
production databases and other services instead of any emulators or test
data you were using.
Prevent traffic being automatically routed to your new version upon deployment:
gcloudappdeploy--no-promote
When you've confirmed that your app is interacting with your production databases
and datastores, use the Google Cloud console to migrate traffic:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["# Testing and deploying your upgraded app in Python 3\n\n### Region ID\n\nThe \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e is an abbreviated code that Google assigns\nbased on the region you select when you create your app. The code does not\ncorrespond to a country or province, even though some region IDs may appear\nsimilar to commonly used country and province codes. For apps created after\nFebruary 2020, \u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e`.r` is included in\nApp Engine URLs. For existing apps created before this date, the\nregion ID is optional in the URL.\n\nLearn more\n[about region IDs](/appengine/docs/standard/python3/how-requests-are-routed#region-id). \nOK\n\nAfter you upgrade your app to be compatible with both Python 2 and Python 3:\n\n1. [Test the app in a local Python 3 environment](#test_locally).\n\n2. [Deploy and test in App Engine](#testing-on-app-engine) without\n shifting traffic to your app.\n\n3. [Migrate traffic to your app](#shifting_traffic).\n\nYou may need to spend significant time fixing compatibility issues that aren't\nvisible until you run your upgraded app in a Python 3 environment.\n\nTo avoid using production data and Google Cloud quota during testing, you can\nuse the following emulators:\n\n- [Datastore](/datastore/docs/tools/datastore-emulator)\n- [Bigtable](/bigtable/docs/emulator)\n- [Pub/Sub](/pubsub/docs/emulator)\n\nOther Google Cloud services such as Cloud Storage and\nMemorystore don't provide emulators.\n\nTesting locally\n---------------\n\nTo test your app's functionality before deploying, follow the instructions for\n[running locally](/appengine/docs/standard/testing-and-deploying-your-app#running_locally)\nin the Python 3 runtime.\n\nTesting on App Engine before shifting traffic\n---------------------------------------------\n\nBefore routing traffic to your upgraded Python app, deploy the app to the\nApp Engine Python 3 runtime for another round of testing. For example,\nto test your app's `default` service:\n\n1. Make sure you've\n [updated the app's configuration files](/appengine/docs/standard/python3/migrate-to-python3/config-files) for\n compatibility with the Python 3 runtime.\n\n Don't change environment variables that send requests to emulators or\n test databases until you're ready to [shift traffic to your app](#shifting_traffic).\n2. Deploy your new version, but prevent traffic from automatically routing\n to the new version:\n\n ```bash\n gcloud app deploy --no-promote\n ```\n\n \u003cbr /\u003e\n\n3. Access your new version by navigating to the following URL:\n\n\n `https://`\u003cvar translate=\"no\"\u003eVERSION_ID\u003c/var\u003e`-dot-default-dot-`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com`\n | **Note:** You can find the version ID in the [Google Cloud console](https://console.cloud.google.com/appengine/versions), or specify one when you deploy with the `--version flag`. The gcloud CLI also outputs the version ID when you deploy.\n\nNow you can test your new version in the App Engine runtime\nenvironment. You can debug your application by viewing its logs. For more\ninformation, see [Writing Application Logs](/appengine/docs/standard/writing-application-logs).\n\nRequests sent to\n`https://`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com`\nare routed to the version previously configured to receive traffic.\n\nTo test new versions of other services, follow the same process, but replace\n`default` in the URL with your service's name:\n\n\n`https://`\u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e`-dot-`\u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e`-dot-`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003e\u003ca href=\"#appengine-urls\" style=\"border-bottom: 1px dotted #999\" class=\"devsite-dialog-button\" data-modal-dialog-id=\"regional_url\" track-type=\"progressiveHelp\" track-name=\"modalHelp\" track-metadata-goal=\"regionalURL\"\u003eREGION_ID\u003c/a\u003e\u003c/var\u003e`.r.appspot.com`\n\nFor more information about targeting specific services and versions, see\n[How Requests are Routed](/appengine/docs/standard/how-requests-are-routed).\n\nMigrating traffic to your app\n-----------------------------\n\nWhen you're ready to send traffic to the new version:\n\n1. Update environment variables in your `app.yaml` file to send requests to your\n production databases and other services instead of any emulators or test\n data you were using.\n\n2. Prevent traffic being automatically routed to your new version upon deployment:\n\n \u003cbr /\u003e\n\n ```bash\n gcloud app deploy --no-promote\n ```\n\n \u003cbr /\u003e\n\n3. When you've confirmed that your app is interacting with your production databases\n and datastores, use the Google Cloud console to migrate traffic:\n\n [Manage versions](https://console.cloud.google.com/appengine/versions)\n\n Select the latest version of your upgraded app and click\n **Migrate traffic**."]]