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

Python Flask with Waitress WSGI not working with Heroku

我正在学习如何构建 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

您可能需要这样的东西:

web: waitress-serve --port=$PORT website:app

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