如何 link 到正确端口上的 Heroku 应用程序?

How to link to Heroku app on correct port?

我有一个 Oython 应用程序。这是带有 aiohttp 的单个脚本。我有一个 requirements.txtProcfile。我的部署阶段成功完成,但我无法理解如何使用正确的端口打开应用程序。

我的应用监听 Heroku PORT env.

Heroku 日志 returns:

2019-04-19T13:34:44.150477+00:00 app[api]: Release v7 created by user 
doubledare704@gmail.com
2019-04-19T13:34:44.150477+00:00 app[api]: Deploy 1b35a335 by user 
doubledare704@gmail.com
2019-04-19T13:34:45.357983+00:00 heroku[worker.1]: State changed from 
crashed to starting
2019-04-19T13:34:48.854124+00:00 heroku[worker.1]: Starting process with 
command `python index.py`
2019-04-19T13:34:49.473879+00:00 heroku[worker.1]: State changed from 
starting to up
2019-04-19T13:34:51.167617+00:00 app[worker.1]: ======== Running on 
http://0.0.0.0:10303 ========
2019-04-19T13:34:51.167652+00:00 app[worker.1]: (Press CTRL+C to quit)
2019-04-19T13:34:54.000000+00:00 app[api]: Build succeeded
2019-04-19T13:35:05.578025+00:00 heroku[router]: at=error code=H14 desc="No 
web processes running" method=GET path="/" host=google-adschecker- 
704.herokuapp.com request_id=8a85c812-a4b9-4d8f-98f6-91a8ff557594 
fwd="93.170.115.160" dyno= connect= service= status=503 bytes= protocol=https
2019-04-19T13:35:05.888452+00:00 heroku[router]: at=error code=H14 desc="No 
web processes running" method=GET path="/favicon.ico" host=google- 
adschecker-704.herokuapp.com request_id=a7be2157-523c-4d00-9a26-a68e7d40e1fd 
fwd="93.170.115.160" dyno= connect= service= status=503 bytes= protocol=https

H14 错误说的是测功机,但我已经打开了 1 个测功机。如何将所有 HTTP 请求切换到该端口?或者如何在 Heroku 上管理设置?

这是我的 Procfile:

worker: python index.py

Workers can't receive network requests from the internet:

A Heroku app’s web process type is special: it’s the only process type that can receive external HTTP traffic from Heroku’s routers. If your app includes a web server, you should declare it as your app’s web process.

通过修改您的 Procfile 将您的主要流程类型从 worker 更改为 web

web: python index.py