如何从gcloud工具中检索App Engine应用程序的源代码? [英] How do I retrieve my App Engine app's source code from the `gcloud` tool?
问题描述
我已迁移到新系统,并且丢失了App Engine应用程序的本地副本.愚蠢的是,我没有使用源代码控制.
I've migrated to a new system and lost my local copy of my App Engine app. Foolishly, I didn't use source control.
我知道我过去曾经使用gcloud
工具来检索我的项目的源代码,但是我似乎无法找到再次执行该操作的方法.我发现的所有内容都指向如何使用appcfg.py
,而gcloud
却没有.我知道我曾经为此目的使用gcloud
,但是没有问题,所以我对如何不再找到该命令感到困惑.
I know I've used the gcloud
tool to retrieve the source code of my project in the past, but I don't seem to be able to find how to do it again. Everything I find points toward how to use appcfg.py
, which didn't come with gcloud
. I know I've used gcloud
for this purpose before with no issues, though, so I'm perplexed as to how I can't find the command anymore.
此外,关于使用Cloud Build的此答案不适用于我-尚未启用Cloud Build
Furthermore, this answer about using Cloud Build doesn't work for me - Cloud Build was not and is not enabled.
推荐答案
过去,人们可以使用以下命令下载已部署应用程序的源代码:
In the past, one was able to download the source code for the deployed app using the command:
gcloud preview app modules download default --version app_version --output-dir=my_dir
(请参阅此线程 gcloud:如何通过cli下载应用).
但是,此后不推荐使用命令gcloud preview app modules download
(因为Zachary Newman转达了 Google Cloud SDK版本重大更改"部分中的版本92.0.0(2016-1-13)的注释:已删除不推荐使用的gcloud preview app modules download
命令.")
However, the command gcloud preview app modules download
has since been deprecated (as Zachary Newman relayed here - see also the Google Cloud SDK Release Notes for version 92.0.0 (2016-1-13) in the "Breaking Changes" section: "Removed deprecated gcloud preview app modules download
command.").
当前,推荐使用appcfg.py,您可以调用该命令之一:
Currently, appcfg.py is the recommended way to go, and you can invoke that command either:
- 来自 Cloud Shell ,或者
- 直接从已安装的Cloud SDK子文件夹
/google-cloud-sdk/platform/google_appengine/
- from the Cloud Shell, or,
- directly from the installed Cloud SDK subfolder
/google-cloud-sdk/platform/google_appengine/
本文详细显示如何使用appcfg.py
命令下载源代码,还可以输入appcfg.py download_app --help
或选中此答案有关如何检索特定服务/模块和版本的源代码的更多详细信息.
This article shows in detail how to download the source code by using the appcfg.py
command, and you can also enter appcfg.py download_app --help
or check this answer for more details on how to retrieve the source code for specific services/modules and versions.
我还要补充一点,您可以在 Stackdriver Debugger Cloud Console面板.
I would also add that you can see the deployed source code of your application in the Stackdriver Debugger panel of the Cloud Console.
这篇关于如何从gcloud工具中检索App Engine应用程序的源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!