带有 Waitress WSGI 的 Python Flask 无法与 Heroku 一起使用

Roh*_*han 3 python heroku flask gunicorn waitress

我正在学习如何构建 Web 应用程序并将其放在 Heroku 上。

我制作了一个基本的 HTML 网站,它在本地服务器上完美运行,但在 Heroku 上显示“应用程序错误”。我最初使用gunicorn(这给了我一个H10错误),后来我了解到gunicorn与Windows不兼容,所以我切换到Waitress WSGI。这次我收到 H14 错误代码。

我试过heroku ps:scale web=1

我收到此错误: Scaling dynos... ! ! Couldn't find that process type (web).

我几乎尝试了互联网上的所有内容,但遗憾的是我无法克服错误并托管我的网站。真是令人沮丧。

这是我当前的 Procfile:waitress-serve --listen=*:8000 website.wsgi:app

我也尝试过waitress-serve --listen=*:8000 website.py:app,错误是无法区分的:(

这是我的 Heroku 日志输出:-

2020-07-06T08:08:03.848586+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=brohan-wsite.herokuapp.com request_id=72a95aa5-8d84-486f-b036-dc738d9cc62c fwd="106.215.63.163" dyno= connect= service= status=503 bytes= protocol=https

Mik*_*keP 5

您可能需要类似的东西:

web: waitress-serve --port=$PORT website:app
Run Code Online (Sandbox Code Playgroud)

Heroku 动态定义端口,因此硬编码端口 8000 不起作用。