django - 带有 xmlsec 设置的 Google App Engine 自定义运行时
问题描述
我们目前在 Google App Engine 中托管我们的 Django 应用程序。我们有一个带有 python 运行时的 flex 环境,它运行良好。我们正在将 saml auth 添加到我们的应用程序中,为此我们需要该xmlsec
包。我们一直在尝试将运行时更改为custom
并将 a 添加Dockerfile
到同一文件夹中。我们看到 Dockerfile 执行并且 xmlsec 包正在安装。但是当我们尝试部署 app.yaml 时,我们会得到一个我们无法理解的错误:
Step #5: Updating service [default] (this may take several minutes)...
Step #5: .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................failed.
Step #5: ERROR: (gcloud.app.deploy) Error Response: [9] Flex operation projects/autonomous-tube-234620/regions/us-central1/operations/f08e56d1-aedb-492d-ab66-738e86935bd6 error [FAILED_PRECONDITION]: An internal error occurred while processing task /app-engine-flex/flex_await_healthy/flex_await_healthy>2021-06-10T18:02:14.559Z137991.in.1: [2021-06-10 15:02:21 +0000] [7] [INFO] Starting gunicorn 19.9.0
Step #5: [2021-06-10 15:02:21 +0000] [7] [INFO] Listening at: http://0.0.0.0:8080 (7)
Step #5: [2021-06-10 15:02:21 +0000] [7] [INFO] Using worker: sync
Step #5: [2021-06-10 15:02:21 +0000] [10] [INFO] Booting worker with pid: 10
Step #5: [2021-06-10 15:02:21 +0000] [10] [ERROR] Exception in worker process
Step #5: Traceback (most recent call last):
Step #5: File "/opt/python3.7/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
Step #5: worker.init_process()
Step #5: File "/opt/python3.7/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
Step #5: self.load_wsgi()
Step #5: File "/opt/python3.7/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
Step #5: self.wsgi = self.app.wsgi()
Step #5: File "/opt/python3.7/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
Step #5: self.callable = self.load()
Step #5: File "/opt/python3.7/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
Step #5: return self.load_wsgiapp()
Step #5: File "/opt/python3.7/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
Step #5: return util.import_app(self.app_uri)
Step #5: File "/opt/python3.7/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
Step #5: __import__(module)
Step #5: ModuleNotFoundError: No module named 'mysite'
Step #5: [2021-06-10 15:02:21 +0000] [10] [INFO] Worker exiting (pid: 10)
Step #5: [2021-06-10 15:02:21 +0000] [7] [INFO] Shutting down: Master
Step #5: [2021-06-10 15:02:21 +0000] [7] [INFO] Reason: Worker failed to boot.
Step #5:
我们的 app.yaml:
service: default
runtime: custom
env: flex
我们的 Dockerfile:
FROM gcr.io/google-appengine/python
RUN apt -y update
RUN apt-get -y install xmlsec1 openssl python-lxml libxmlsec1 libxmlsec1-dev libxml2-dev libxmlsec1-openssl
ADD requirements.txt /app/
RUN pip3 install -r requirements.txt
ADD . /app/
ENV ENV production
ENV GOOGLE_APPLICATION_CREDENTIALS mycreds.json
ENTRYPOINT ["gunicorn", "-t", "120", "-b", ":$PORT", "mysite.wsgi"]
有人可以解释一下问题可能是什么吗?该应用程序在本地环境中正常工作(在本地使用 Docker)。提前致谢
解决方案
推荐阅读
- python - 跨多个文件的烧瓶 sqlalchemy 关系
- mysql - mysql docker中用户'root'@'localhost'的访问被拒绝
- nginx - 在 nginx 中停止(从位置退出)执行具有良好返回码的位置是真的吗?
- css - css模块中未生成的类名选择器
- linux - PPID 1 和错误的僵尸进程 - 无法获取属性:org.freedesktop.systemd1 的激活超时
- javascript - 输入字段中的第一个字母显示,其余字母不可见,如 ****** 如何在 javascript 和 typescript 中执行?
- google-cloud-platform - 有没有办法编写与目录中的文件或同一目录中的整个目录匹配的 glob 模式?
- php - 如何从 CSV 文件中将不同的行放入表中?
- c - Linux内核列表,释放内存
- google-cloud-dataflow - 测试 Beam PipelineOptions ValueProvider 的 @Default 值