Python 2.7 已达到支持终止期限,并将于 2026 年 1 月 31 日
弃用。弃用后,您将无法部署 Python 2.7 应用,即使您的组织之前曾使用组织政策重新启用旧版运行时的部署也是如此。现有的 Python 2.7 应用在
弃用日期之后将继续运行并接收流量。我们建议您
迁移到最新支持的 Python 版本。
了解数据和文件存储
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如需在 App Engine 上存储数据和文件,您可以使用 Google Cloud 服务,或使用受您的语言支持并可从 App Engine 实例访问的任何其他存储服务。第三方数据库可以由其他云服务商托管、在本地托管或由第三方供应商管理。
Google Cloud 存储服务
对于在 Python 2 标准环境中运行的 App Engine 应用,我们建议使用以下任一 Google Cloud 存储服务:
这些存储方案并不相互排斥。例如,同一应用既可以将信息存储在 Cloud SQL 数据库中,也可以将文件存储在 Cloud Storage 存储分区中。
如需查看 Google Cloud 存储产品的完整列表,请参阅 Cloud Storage 产品页面。
其他云服务商
App Engine 应用可以连接到其他公有云上托管的外部数据库,前提是这些数据库服务器和您的防火墙已正确配置,可以接受连接。您的 App Engine 应用使用该外部服务的公共 IP 地址通过互联网进行连接。
由第三方供应商管理的数据库
很多供应商都提供代管式数据库服务,例如 mLab 提供 MongoDB 服务,而 Redis Labs 提供托管式 Redis 缓存服务。这些供应商会处理数据库的托管、配置和维护。App Engine 可以通过互联网连接到这些外部服务,具体方式与其他公有云使用这些服务的公共 IP 地址进行连接时相同。
本地
如果您希望 App Engine 应用可以访问您的现有本地数据库,可以通过配置内部网络和防火墙来为数据库提供一个公共 IP 地址,也可以使用 VPN 进行连接。
生产注意事项
App Engine 可配置为根据各种指标自动横向扩缩应用。与 Web 应用不同,数据库通常需要进行大幅度的调整来响应扩缩要求。在生产应用中,App Engine 可能会在流量高峰期使数据库急速过载。在配置和部署数据库时,您应该考虑预期的平均流量负载及高峰期负载。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[[["易于理解","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-08-21。"],[[["\u003cp\u003eApp Engine allows data storage through Google Cloud services, external cloud providers, third-party vendors, or on-premises databases.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud offers several storage options including Firestore in Datastore mode (NoSQL), Cloud SQL (relational), and Cloud Storage (file storage), each with unique consistency models and pricing structures.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine apps can connect to external databases hosted on other cloud platforms or managed by third-party vendors, provided the servers and firewalls are configured to allow connections via public IP addresses.\u003c/p\u003e\n"],["\u003cp\u003eFor on-premises databases, connectivity to App Engine can be established by configuring a public IP address for the database or using a VPN.\u003c/p\u003e\n"],["\u003cp\u003eDatabase scalability should be carefully considered in production, as App Engine's ability to scale horizontally can lead to traffic spikes that overwhelm databases if they are not configured appropriately.\u003c/p\u003e\n"]]],[],null,["# Understanding Data and File Storage\n\nTo store data and files on App Engine, you can use Google Cloud services\nor any other storage service that is supported by your language and is\naccessible from your App Engine instance. Third-party databases\ncan be hosted on another cloud provider,\nhosted on premises, or managed by a third-party vendor.\n\nGoogle Cloud storage services\n-----------------------------\n\nFor App Engine apps running in the Python 2 standard environment, we recommend\none of the following Google Cloud storage services:\n\n\nThese options are not mutually exclusive. For example, the same application\ncan store information in a Cloud SQL database, and also store files in a Cloud\nStorage bucket.\n\n\u003cbr /\u003e\n\nSee a complete list of the Google Cloud storage products on the\n[Cloud Storage Products page](/products/storage).\n\nOther cloud providers\n---------------------\n\nApp Engine apps can connect to external databases that are hosted on\nother public clouds as long as those database servers and your firewall are\nconfigured properly to accept connections. Your App Engine app connects\nover the Internet using that external service's public IP address.\n\nDatabases managed by a third-party vendor\n-----------------------------------------\n\nThere are many vendors offering managed database services such as\n[mLab](/mongodb) for MongoDB, Redis Labs offers hosted\n[Redis caching](https://redislabs.com/redis-enterprise/cloud/). These vendors handle\nhosting, configuration, and maintenance of databases. App Engine can\nconnect to these external services over the Internet, in the same way as other\npublic clouds by using that service's public IP address.\n\nOn premises\n-----------\n\nIf you have existing on-premises databases that you want to make accessible to\nyour App Engine app, you can either configure your internal\nnetwork and firewall to give the database a public IP address or connect using a\nVPN.\n\nProduction considerations\n-------------------------\n\nApp Engine can be configured to automatically scale your application\n[horizontally](https://wikipedia.org/wiki/Scalability#Horizontal_and_vertical_scaling)\nbased on various metrics. Unlike web applications, databases often\nrequire non-trivial changes to respond to scale. In production applications,\nApp Engine can quickly overwhelm a database during traffic spikes. You\nshould take the anticipated average traffic load and load during spikes into\nconsideration when configuring and deploying databases."]]