【问题标题】:Simple static webpage deployment on app engine standard throwing errors suddenly应用引擎标准上的简单静态网站部署突然抛出错误
【发布时间】:2021-11-18 04:13:23
【问题描述】:

多年来,我一直通过谷歌应用引擎标准 python 设置托管我的静态网站,没有出现任何问题。今天我开始看到下面的错误。注意:以前在 GCP 上有一个页面解释如何使用 python GAE 标准托管静态页面,但我现在找不到。是不是现在建议改用桶?

gunicorn.errors.HaltServer
Traceback (most recent call last): File "/layers/google.python.pip/pip/bin/gunicorn", line 8, in sys.exit(run()) File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in run WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/base.py", line 228, in run super().run() File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/base.py", line 72, in run Arbiter(self).run() File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/arbiter.py", line 229, in run self.halt(reason=inst.reason, exit_status=inst.exit_status) File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/arbiter.py", line 342, in halt self.stop() File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/arbiter.py", line 393, in stop time.sleep(0.1) File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld self.reap_workers() File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/arbiter.py", line 525, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer:

这是我的 app.yaml 文件:

runtime: python38
service: webapp

handlers:

# site root -> app
- url: /
  static_files: dist/index.html
  upload: dist/index.html
  expiration: "0m"
  secure: always

# urls with no dot in them -> app
- url: /([^.]+?)\/?$  # urls
  static_files: dist/index.html
  upload: dist/index.html
  expiration: "0m"
  secure: always

# everything else
- url: /(.*)
  static_files: dist/\1
  upload: dist/(.*)
  expiration: "0m"
  secure: always

【问题讨论】:

  • 您使用的是哪个 gunicorn 版本?
  • 我根本没有使用 gunicorn :-) 从字面上看,我只是在上面托管静态文件。我认为正在发生的事情是应用程序引擎标准在后台使用 gunicorn 作为网络服务器。 @AkshanshaSinghal
  • 你能检查一下这些线程吗:Thread1, Thread2
  • @AkshanshaSinghal 谢谢。我看了一下那两个线程。它们似乎不同,一个与设置本地 python Web 服务器有关,另一个似乎与应用程序引擎 flex 有关。我的设置非常简单,我什至没有运行一个 python 文件。只需使用应用引擎来托管一个完全静态的网站,这曾经是他们推荐的。它很方便,因为您可以使用所有应用引擎版本控制、a/b 测试以及域规则等。
  • 你能显示你的 requirements.txt 文件吗?

标签: google-app-engine


【解决方案1】:

这个错误只发生在 11 月 17 日,此后再也没有发生,我没有做任何更改。也许它与谷歌应用引擎服务器上的某些东西有关。

【讨论】:

    【解决方案2】:

    请注意,根据app.yaml 文件,您使用的是 Python 3.8,并且您共享的文档适用于 Python 2.7。由于不再支持 Python 2,因此从 Python 2 迁移到 Python 3 运行时将帮助您消除错误。

    文档here 将帮助您迁移到 Python 3 标准运行时。

    【讨论】:

    • 嗯,这没有意义。正如我所说,我没有使用任何python。没有什么可迁移的。
    • 如果你仔细看,你会发现文档并不是专门关于 2.7 的,它是关于如何在 google 应用引擎上启动“静态网站”的。您实际上可以指定任何运行时间来执行此操作,因为它们都可以托管静态文件。我发布 2.7 文档的原因是 3.x 不存在该页面。我想知道谷歌是否正在为此目的推动使用云存储。但这不太方便。
    猜你喜欢
    • 2021-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-25
    • 1970-01-01
    • 1970-01-01
    • 2020-04-04
    • 1970-01-01
    相关资源
    最近更新 更多