首页 > 解决方案 > 使用 Django 在谷歌应用引擎中部署时,PyYAML 有多重要?

问题描述

最近我尝试在谷歌应用引擎中部署我的 django 应用(标准环境 - Python 版本 3.7 - Django 版本 2.0.3),但我发现了一个问题。

作为执行部署的上一步,我运行:

pip freeze > requirements.txt

但是在部署时会产生这个错误:

Error message: `pip_download_wheels` had stderr output:
  Failed building wheel for PyYAML
ERROR: Failed to build one or more wheels

error: `pip_download_wheels` returned code: 1.

当我意识到错误是由 PyYAML 引起的时,我尝试修改 requirements.txt 文件中的版本,但没有成功。

作为最后一步,我选择从我的 requirements.txt 文件中删除 PyYAML,在这种情况下它有效。应用程序已部署并正在运行。

但是我的问题是:在 requirements.txt 中不包含 PyYAML 的情况下进行部署是否有问题?

标签: djangogoogle-app-enginegoogle-cloud-platformpyyaml

解决方案


对于那些可能感兴趣的人,答案是这样的:

Google app Engine(标准环境)不允许安装 PyYaml,因为默认情况下它已安装:

https://cloud.google.com/appengine/docs/standard/python/refdocs/

因此在 requirements.txt 中不添加 PyYaml 是没有问题的

PD:PyYaml 库似乎已添加到 requirements.txt 文件中,因为 pip 正在识别文件夹中的 yaml 文件并确定应用程序必须正常工作。


推荐阅读