【发布时间】:2021-07-06 10:47:59
【问题描述】:
我一直在尝试访问我的 django 网站,但每次都遇到相同的 502 BAD CONNECTION nginx 错误,我不知道如何解决它。
当我使用 py.manager runserver 运行程序时,它运行得非常好,但是我只在运行gcloud app deploy 时收到一个错误,查看日志我没有收到任何错误,只有一个警告说明Container called exit(1).
我尝试了 Google 网站上的一种解决方案:https://cloud.google.com/endpoints/docs/openapi/troubleshoot-response-errors,然后我将 resources: memory_gb: 4 添加到了我的 app.yaml 文件中,但最终还是出现了错误。
我不确定这对我的 app.yaml 有多大帮助,目前看起来像这样:
runtime: python39
handlers:
# This configures Google App Engine to serve the files in the app's static
# directory.
- url: /static
static_dir: static/
# This handler routes all requests not caught above to your main app. It is
# required when static routes are defined, but can be omitted (along with
# the entire handlers section) when there are no static files defined.
- url: /.*
script: auto
resources:
memory_gb: 4
我的 gcloudignore 看起来像这样:
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic 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
secret_variables.py
.venv
Pipfile
Pipfile.lock
# Python pycache:
__pycache__/
# Ignored by the build system
/setup.cfg
提前感谢您的帮助
【问题讨论】:
-
你有你想要部署在 github 某处的代码吗?
-
@jabbson,是的,链接如下:github.com/yousefsaid/test
-
我从 pip 文件中添加了一些要求,我刚刚意识到有些安装是重叠的
-
您在需求中缺少 django-filter
-
我什至没有意识到,谢谢你的帮助@jabbson!
标签: django nginx google-app-engine google-cloud-platform error-handling