App Engine 标准上的简单静态网页部署突然抛出错误
Simple static webpage deployment on app engine standard throwing errors suddenly
多年来,我一直通过 google 应用引擎标准 python 设置托管我的静态网站,没有出现任何问题。今天我开始看到下面的错误。注意:GCP 上曾经有一个页面解释如何使用 python GAE 标准托管静态页面,但我现在找不到了。是不是现在建议改用bucket?
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/
upload: dist/(.*)
expiration: "0m"
secure: always
请注意,根据您的 app.yaml
文件,您使用的是 Python 3.8,而您共享的文档适用于 Python 2.7。由于不再支持 Python 2,从 Python 2 迁移到 Python 3 运行时将帮助您消除错误。
文档 here 将帮助您迁移到 Python 3 标准运行时。
这个错误是在11月17日才发生的,之后就没有再发生过,我没有做任何修改。也许它与 google 应用引擎服务器上的某些底层内容有关。
多年来,我一直通过 google 应用引擎标准 python 设置托管我的静态网站,没有出现任何问题。今天我开始看到下面的错误。注意:GCP 上曾经有一个页面解释如何使用 python GAE 标准托管静态页面,但我现在找不到了。是不是现在建议改用bucket?
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/
upload: dist/(.*)
expiration: "0m"
secure: always
请注意,根据您的 app.yaml
文件,您使用的是 Python 3.8,而您共享的文档适用于 Python 2.7。由于不再支持 Python 2,从 Python 2 迁移到 Python 3 运行时将帮助您消除错误。
文档 here 将帮助您迁移到 Python 3 标准运行时。
这个错误是在11月17日才发生的,之后就没有再发生过,我没有做任何修改。也许它与 google 应用引擎服务器上的某些底层内容有关。