Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine 使用Google Cloud Build部署到Google App Engine时未正确安装依赖项(requirements.txt)_Google App Engine_Google Cloud Build - Fatal编程技术网

Google app engine 使用Google Cloud Build部署到Google App Engine时未正确安装依赖项(requirements.txt)

Google app engine 使用Google Cloud Build部署到Google App Engine时未正确安装依赖项(requirements.txt),google-app-engine,google-cloud-build,Google App Engine,Google Cloud Build,在将应用程序部署到Google App Engine(Python 2.7)时,我遇到了一个奇怪的依赖性问题 我已在requirements.txt文件中指定了依赖项: Flask==1.0.2 werkzeug>=0.14 flask-cors twilio httplib2 gunicorn Jinja2 google-cloud-ndb exponent_server_sdk 当使用requirements.txt文件夹中的pip在本地安装时,这些工具可以与本地开发服务器配合使用

在将应用程序部署到Google App Engine(Python 2.7)时,我遇到了一个奇怪的依赖性问题

我已在requirements.txt文件中指定了依赖项:

Flask==1.0.2
werkzeug>=0.14
flask-cors
twilio
httplib2
gunicorn
Jinja2
google-cloud-ndb
exponent_server_sdk
当使用requirements.txt文件夹中的pip在本地安装时,这些工具可以与本地开发服务器配合使用

但是,当我部署到app engine时,似乎尚未安装模块exponent_server_sdk(ImportError:没有名为exponent_server_sdk的模块)

我通常通过推送到git存储库进行部署,然后使用Google Cloud Build(“gcr.io/Cloud builders/gcloud”)进行部署。部署时没有错误,requirements.txt文件中的其他依赖项(如twilio或Jinja2)工作正常

在调查这一点时,我尝试使用gcloud app deploy从我的开发机器直接推送。当我这样做时,出于某种奇怪的原因,exponent_server_sdk是可用的,并且工作正常

这种行为对我来说似乎很奇怪,我找不到任何关于人们经历类似错误的文档。我想知道是否有人能给我一些关于可能导致此问题的原因的指导,或者我可以查找错误的地方(例如在部署/实例启动期间安装requirements.txt文件的过程日志)

针对这些评论:

我在标准环境中运行

我的cloudbuild.yaml如下所示:

steps:
- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy", "app.yaml", "dispatch.yaml", "service_1.yaml", "service_2.yaml", "service_3.yaml", "index.yaml"]
timeout: "1600s"
runtime: python27
api_version: 1
threadsafe: true
service: notifications

libraries:
- name: ssl
  version: latest

handlers:
- url: /.*
  script: notifications.app
我遇到错误的服务的.yaml文件如下所示:

steps:
- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy", "app.yaml", "dispatch.yaml", "service_1.yaml", "service_2.yaml", "service_3.yaml", "index.yaml"]
timeout: "1600s"
runtime: python27
api_version: 1
threadsafe: true
service: notifications

libraries:
- name: ssl
  version: latest

handlers:
- url: /.*
  script: notifications.app
对于(第1代)标准环境,部署过程不使用
requirements.txt
文件,库应安装在应用程序中。发件人:

将(版本6或更高版本)与
-t
标志一起使用,以 将库复制到在上一步中创建的文件夹中。 例如:

pip install -t lib/ <library_name>
pip安装-t lib/
是的,如果您愿意,您可以使用
requirements.txt
文件在应用程序内进行安装,但部署过程中不使用该文件本身


由于您不是直接从安装了库的环境中进行部署,因此您还必须将安装目录添加到git repo。

您可以演示如何使用用于部署的
cloudbuild.yaml
文件吗?标准环境?@DanCornilescu是,我使用的是标准environment@LundinCast我已经添加了cloudbuild.yamlc,您可以添加有故障的服务的app.yaml文件吗?谢谢!我一直认为requirements.txt文件用于部署。事实证明,我之前一直在将我的lib文件夹签入存储库,当时我并不打算签入,但后来将其添加到了.gitignore,这意味着没有包含这个新包。