python - 在部署到 App Engine 期间不考虑 Gcloudignore 文件

标签 python google-app-engine google-cloud-platform gcloud

gcloud app deploy 不断上传源目录中的所有文件,尽管我已使用 .gcloudignore 文件明确排除它们。例如,上传了虚拟环境文件夹 env,这会导致错误,因为部署包含超过 10,000 个文件。

我在 Windows 10 下工作,使用 Python 3.7 和 gcloud SDK 版本 251.0.0。我尝试了 gcloud app deploy 的 beta 版和普通版。

.gcloudignore 文件仅包含以下内容:

  .gcloudignore
  # If you would like to upload your .git directory, .gitignore file or
  # files from your .gitignore file, remove the corresponding line below:
  .git
  .gitignore
  #!include:.gitignore

我可以在带有 --verbosity=info 标志的输出中看到它识别了 .gcloudignore 文件,但随后它上传了 env 文件夹到云存储。我希望跳过此文件夹。 Git 按预期工作。

最佳答案

您可以通过添加以下行将您的 .gitignore 文件忽略的所有内容“包含”到您的 .gcloudignore 文件中:

#!include:.gitignore

如果您的 .gitignore 文件已经忽略了 env 目录,这将导致 gcloud 也忽略它(以及所有其他文件那个 git 忽略了)。

关于python - 在部署到 App Engine 期间不考虑 Gcloudignore 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56767012/

相关文章:

python - 用于 Linux 的 Python 中的终端窗口关闭事件处理程序

python - appengine 根据时间戳进行选择

javascript - “超过 5000 个字符限制”使用 SSML 与文本输入 : Google Text-to-Speech (TTS)

python - 为什么在 GCP 上从 python 生成重复的 UUID?

google-app-engine - 使用 Google App Engine 灵活环境的多种服务

apache-spark - Spark - 将 JDBC 驱动程序 JAR 添加到 Google Dataproc

python - 函数在空序列上失败

python - 将bashrc的环境变量加载到python中

python - 在图形工具中更改背景颜色

google-app-engine - 在 GAE 上使用 Rest API