【发布时间】: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
-
@AkshanshaSinghal 谢谢。我看了一下那两个线程。它们似乎不同,一个与设置本地 python Web 服务器有关,另一个似乎与应用程序引擎 flex 有关。我的设置非常简单,我什至没有运行一个 python 文件。只需使用应用引擎来托管一个完全静态的网站,这曾经是他们推荐的。它很方便,因为您可以使用所有应用引擎版本控制、a/b 测试以及域规则等。
-
你能显示你的 requirements.txt 文件吗?