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
Django Google应用程序引擎标准无法找到/执行Gunicorn_Django_Google App Engine_Gunicorn_Google Cloud Build - Fatal编程技术网

Django Google应用程序引擎标准无法找到/执行Gunicorn

Django Google应用程序引擎标准无法找到/执行Gunicorn,django,google-app-engine,gunicorn,google-cloud-build,Django,Google App Engine,Gunicorn,Google Cloud Build,我有一个带有Django后端和角度前端的项目。我已经将它们作为两个服务部署到了谷歌应用程序引擎标准版中,并且部署成功了 然而,当我尝试访问后端urlthis backend.appspot.com时,我得到了 /bin/sh: 1: exec: gunicorn: not found 我的需求文件中有gunicorn: gunicorn==19.9.0 我还定义了入口点: runtime: python37 service: default entrypoint: gunicorn -b

我有一个带有Django后端和角度前端的项目。我已经将它们作为两个服务部署到了谷歌应用程序引擎标准版中,并且部署成功了

然而,当我尝试访问后端url
this backend.appspot.com
时,我得到了

/bin/sh: 1: exec: gunicorn: not found
我的需求文件中有gunicorn

gunicorn==19.9.0
我还定义了入口点:

runtime: python37
service: default

entrypoint: gunicorn -b :$PORT thisapp.wsgi

handlers:
- url: /static
  static_dir: static
- url: /.*
  secure: always
  redirect_http_response_code: 301
  script: auto
但仍然会得到相同的错误

我研究了Stackoverflow上所有相同的问题,它们要么是因为需求,要么是因为我定义了两者的入口点

即使当我转到Stackdriver时,我也可以看到
应用程序引擎中的gunicorn文件夹://

gunicorn
gunicorn-19.9.0.dist-info
这是后端
cloudbuild.yaml
文件:

steps:

  - name: 'python:3.7'                                                                                                                               
    entrypoint: python3                                                               
    args: ['-m', 'pip', 'install', '-t', '.', '-r', 'requirements.txt'] 

  - name: 'python:3.7'                                                            
    entrypoint: python3                                                           
    args: ['./manage.py', 'collectstatic', '--noinput']

  - name: 'gcr.io/cloud-builders/gcloud'
    args: ['app', 'deploy', '--version=prod']
如果有人有任何解决方案或建议,我将不胜感激,因为我已经在互联网上调查了几乎所有相同的问题

谢谢


James

默认情况下,appengine在App目录的根目录中查找一个名为App的WSGI兼容对象的
main.py
文件

文档建议,如果您在
app.yaml
文件中指定入口点,您可以在
requirements.txt
文件中包含
gunicorn
,但是您要安装的版本似乎与默认版本冲突

为了解决这个问题,我建议您删除requirements.txt文件中的gunicorn依赖项和app.yaml中的entrypoint,并创建一个main.py文件,如下所示:

from thisapp.wsgi import application

app = application

这样,它将返回到上面解释的默认行为,应该可以正常工作。它也以这种方式在官方中实现。

非常有趣!是的,我猜版本有问题。但我去掉了它们,它起了作用。非常感谢你!