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 位址,透過網際網路建立連線。
第三方供應商代管的資料庫
許多服務供應商都提供代管資料庫服務,例如 MongoDB 的 mLab,以及 Redis Labs 提供的託管 Redis 快取服務。這些供應商可處理資料庫的託管、設定和維護作業。App Engine 可以透過網際網路連線至這些外部服務,方法跟其他公用雲端一樣,都是使用服務的公開 IP 位址進行連線。
內部部署
如果想讓 App Engine 應用程式存取現有的內部部署資料庫,您可以設定內部網路和防火牆以提供公用 IP 位址給資料庫,或是使用 VPN 進行連線。
實際運作環境注意事項
您可以透過設定,讓 App Engine 依據各種指標,水平自動調整應用程式的資源配置。資料庫經常會因為資源調度而進行重大變更,這點與網路應用程式不同。在實際運作環境中出現龐大流量時,App Engine 可能會迅速導致資料庫癱瘓。建議您在設定和部署資料庫時,將預期的平均流量負載和尖峰時段負載納入考量。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-04 (世界標準時間)。
[[["容易理解","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 (世界標準時間)。"],[[["\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."]]