Skip to main content
 首页 » 编程设计

python之如何下载特定谷歌云 "service"的代码

2024年10月01日7mq0036

This doc显示下载我在 App Engine 中的应用程序源的命令:

appcfg.py -A [YOUR_APP_ID] -V [YOUR_APP_VERSION] download_app [OUTPUT_DIR] 

很好,但我也部署了服务。使用此命令我似乎只能下载“默认”服务。我还在我的 GCP 项目中将“myservice01”和“myservice02”部署到应用引擎。如何指定要下载的特定服务的代码?

我按照建议尝试了这个命令:

appcfg.py -A [YOUR_APP_ID] -M [YOUR_MODULE] -V [YOUR_APP_VERSION] download_app [OUTPUT_DIR] 

它没有失败,但这是我得到的输出(它没有下载任何东西)

01:30 AM Host: appengine.google.com 
01:30 AM Fetching file list... 
01:30 AM Fetching files... 

现在作为测试,我尝试使用一个我知道不存在的模块的名称,但我收到了这个错误:

Error 400: --- begin server output --- 
Version ... of Module ... does not exist. 

所以我至少知道它成功找到了模块和版本,但似乎不想下载它们?

请您参考如下方法:

同时指定模块(服务过去被称为模块):

-M MODULE, --module=MODULE

Set the module, overriding the module value from app.yaml.

所以像这样:

appcfg.py -A [YOUR_APP_ID] -M [YOUR_MODULE] -V [YOUR_APP_VERSION] download_app [OUTPUT_DIR] 

旁注:YOUR_APP_VERSION 应该真正阅读 YOUR_MODULE_VERSION :)

当然,答案假设应用程序代码下载没有从控制台的 GAE App Settings 永久禁用。页:

Permanently prohibit code downloads

Once this is set, no one, including yourself, will ever be able to download the code for this application using the appcfg download_app command.