heroku 无法使用我的 python 脚本
heroku cannot work with my python script
我是 python 和 Flask 的新手。
flask 的文档说您可以将您的应用程序部署到 heroku 以获得 public 访问权限。所以我转向了 heroku 网站。我一步一步地按照入门指南进行操作。我成功部署了应用程序,但是当我使用给定的 url 测试时,比如 https://mighty-falls-2223.heroku.com/,它说有错误。
错误信息是:
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
我尝试了 heroku logs 命令:
2015-02-06T05:05:23.598482+00:00 heroku[api]: Release v2 created by kelvintgx@yahoo.com
2015-02-06T05:05:23.598482+00:00 heroku[api]: Enable Logplex by kelvintgx@yahoo.com
2015-02-06T05:43:45.975680+00:00 heroku[api]: Deploy 6c41484 by kelvintgx@yahoo.com
2015-02-06T05:43:45.975680+00:00 heroku[api]: Release v3 created by kelvintgx@yahoo.com
2015-02-06T05:45:21.762316+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=a2351725-38cb-4480-a97a-b9cf84b1c8ec fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T05:45:24.285661+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mighty-falls-2323.herokuapp.com request_id=80d64b3a-3da7-4836-a653-0040b43acd0a fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T05:45:58.722807+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/" host=mighty-falls-2323.herokuapp.com request_id=5864f9d0-f4cb-438d-acc6-74c1afb05188 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T05:46:20.066306+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=1b62f73b-3240-4428-bc77-112801685486 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T05:47:57.279689+00:00 heroku[api]: Deploy 6c41484 by kelvintgx@yahoo.com
2015-02-06T05:47:57.279689+00:00 heroku[api]: Release v4 created by kelvintgx@yahoo.com
2015-02-06T06:02:22.868450+00:00 heroku[api]: Release v5 created by kelvintgx@yahoo.com
2015-02-06T06:02:22.868450+00:00 heroku[api]: Deploy 38003ed by kelvintgx@yahoo.com
2015-02-06T06:02:41.211691+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=0be3ab2e-e3d3-4186-8ae2-fddcd5919f11 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T06:03:12.755692+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=dbdcb909-ee4a-4c37-ade0-a2f38d9bad3e fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T06:03:58.407684+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=52d528be-0e19-491d-b80f-a6ed468a687c fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T06:08:41.991908+00:00 heroku[api]: Deploy 9d0211e by kelvintgx@yahoo.com
2015-02-06T06:08:41.991908+00:00 heroku[api]: Release v6 created by kelvintgx@yahoo.com
2015-02-06T06:09:11.138002+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=c2164d36-0c85-43fb-87d0-d637b011116e fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-06T06:09:37.362330+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=49c04057-1a7b-432d-a8a8-7d5687b717d1 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-06T06:10:15.040200+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/index.py/test" host=mighty-falls-2323.herokuapp.com request_id=ef7a49b4-fc15-4876-ae0a-30c866fb6ccd fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T08:03:09.470102+00:00 heroku[api]: Release v7 created by kelvintgx@yahoo.com
2015-02-06T08:03:09.470102+00:00 heroku[api]: Deploy 9d0211e by kelvintgx@yahoo.com
2015-02-06T08:03:38.874551+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=3e7ebf43-d55f-4831-98ee-3758957c6110 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T10:21:31.070674+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=8c2a7f5b-3382-4685-9e50-8415fbfc8703 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-06T10:25:42.879279+00:00 heroku[api]: Starting process with command
false && 自动诊断 运行 由 HEROKU 支持; cat Procfileby kelvintgx@yahoo.com
2015-02-06T10:25:46.887330+00:00 heroku[run.4361]: Awaiting client
2015-02-06T10:25:46.921078+00:00 heroku[run.4361]: Starting process with command
false && 自动诊断 运行 由 HEROKU 支持; cat Procfile
2015-02-06T10:25:48.553909+00:00 heroku[api]: Starting process with command
false && 自动诊断 运行 由 HEROKU 支持; cat requirements.txtby kelvintgx@yahoo.com
2015-02-06T10:25:47.174906+00:00 heroku[run.4361]: State changed from starting to up
2015-02-06T10:25:49.052088+00:00 heroku[run.4361]: Process exited with status 0
2015-02-06T10:25:49.061559+00:00 heroku[run.4361]: State changed from up to complete
2015-02-06T10:25:55.154435+00:00 heroku[run.5301]: Awaiting client
2015-02-06T10:25:55.187005+00:00 heroku[run.5301]: Starting process with command
false && 自动诊断 运行 由 HEROKU 支持; cat requirements.txt
2015-02-06T10:25:55.608338+00:00 heroku[run.5301]: State changed from starting to up
2015-02-06T10:25:57.225198+00:00 heroku[run.5301]: Process exited with status 0
2015-02-06T10:25:57.237272+00:00 heroku[run.5301]: State changed from up to complete
2015-02-06T10:41:02.655049+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=88ad749c-b3c0-41da-8522-052c25beaa58 fwd="82.227.198.77" dyno= connect= service= status=503 bytes=
2015-02-06T10:41:02.986494+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mighty-falls-2323.herokuapp.com request_id=3cb538b8-7020-49c5-8d5f-4752ed41bf17 fwd="82.227.198.77" dyno= connect= service= status=503 bytes=
2015-02-06T10:41:14.129885+00:00 heroku[api]: Starting process with command
bashby damien@heroku.com
2015-02-06T10:41:18.300710+00:00 heroku[run.5301]: Awaiting client
2015-02-06T10:41:18.335348+00:00 heroku[run.5301]: Starting process with command
bash
2015-02-06T10:41:18.590203+00:00 heroku[run.5301]: State changed from starting to up
2015-02-06T10:41:23.138727+00:00 heroku[run.5301]: Process exited with status 0
2015-02-06T10:41:23.148562+00:00 heroku[run.5301]: State changed from up to complete
2015-02-06T13:37:04.131811+00:00 heroku[api]: Starting process with command
cat Procfileby johnb@heroku.com
2015-02-06T13:37:08.374192+00:00 heroku[run.3797]: Starting process with command
cat Procfile
2015-02-06T13:37:08.338415+00:00 heroku[run.3797]: Awaiting client
2015-02-06T13:37:08.560954+00:00 heroku[run.3797]: State changed from starting to up
2015-02-06T13:37:10.089507+00:00 heroku[run.3797]: Process exited with status 0
2015-02-06T13:37:10.113779+00:00 heroku[run.3797]: State changed from up to complete
2015-02-06T23:48:45.731958+00:00 heroku[api]: Deploy 6b11519 by kelvintgx@yahoo.com
2015-02-06T23:48:45.731958+00:00 heroku[api]: Release v8 created by kelvintgx@yahoo.com
2015-02-07T00:09:59.480138+00:00 heroku[api]: Release v9 created by kelvintgx@yahoo.com
2015-02-07T00:09:59.480138+00:00 heroku[api]: Deploy 6b11519 by kelvintgx@yahoo.com
2015-02-07T00:10:48.844680+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=7d1f4f4f-ef77-463c-a7ea-b8f324a659e7 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:10:50.372417+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mighty-falls-2323.herokuapp.com request_id=cb478ca0-26db-4190-a352-73fac8e593bf fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:11:20.708121+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=257aa4ce-fcc5-478a-866e-16b5e06e6b28 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T00:25:01.892151+00:00 heroku[api]: Release v10 created by kelvintgx@yahoo.com
2015-02-07T00:25:01.892151+00:00 heroku[api]: Deploy f656bf6 by kelvintgx@yahoo.com
2015-02-07T00:25:15.504015+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=ef792387-7275-473a-94a4-fd6d79193606 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:25:16.299068+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mighty-falls-2323.herokuapp.com request_id=4bc9fe23-ef1c-4558-8dbc-e7a076184251 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:26:58.704016+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=2d0d428b-6e82-4fba-8bca-62b165dc9a8a fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:26:59.276275+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=56f32a41-ca5d-4177-af86-b5be5122e1a0 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:26:59.401230+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=3c74db5e-a184-43c6-8509-6d2652f98ad5 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:26:59.759710+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=ddb0c3bf-d037-4e88-91d0-527c3bdc5294 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:27:00.002293+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=b8213dc4-68f9-4506-9df3-8f8d9d84c17e fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:27:00.200540+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=4c3972ce-cf8d-455a-9642-fb7ab27614ab fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:27:31.036773+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=7d8cd1cf-047c-4f31-a77a-67d2fd407f3e fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T00:38:10.241481+00:00 heroku[api]: Deploy bce1b94 by kelvintgx@yahoo.com
2015-02-07T00:38:10.241481+00:00 heroku[api]: Release v11 created by kelvintgx@yahoo.com
2015-02-07T00:47:15.189446+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=d1e0f728-f37d-4bbc-934d-710a1bc6c038 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T00:47:16.032290+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mighty-falls-2323.herokuapp.com request_id=922e5bee-44c7-4175-b04a-c678ea892c49 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T05:39:16.650160+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=20cda673-a9d5-4235-8c56-7d4ade42d3af fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T05:42:18.957812+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/test" host=mighty-falls-2323.herokuapp.com request_id=21b650da-b678-4e0f-b25c-07ce57dade4a fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T05:42:30.441817+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=736b31a0-54bd-426e-b139-82e9e3b59cfb fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T05:43:17.115422+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=cf5fc45d-7de3-4ceb-9ddb-e0359e9bee7e fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T05:43:28.889811+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=c28de66f-47fc-43e2-ba31-2cc9f75b60e7 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T05:45:00.848077+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/equations" host=mighty-falls-2323.herokuapp.com request_id=fa17ce1f-3fdf-4d6f-93af-00b4182f39d8 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T08:27:44.307547+00:00 heroku[api]: Deploy 83dff7d by kelvintgx@yahoo.com
2015-02-07T08:27:44.307703+00:00 heroku[api]: Release v12 created by kelvintgx@yahoo.com
2015-02-07T08:28:22.236893+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=f42d825a-11ab-429b-8f37-cf1c2e2fa891 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T08:28:38.028373+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=04e4cf42-ef58-44a4-92d7-5a62598260d7 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T08:29:15.618833+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=869ae9c3-4132-43d6-b84b-f8a4ea47375f fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T08:30:25.316324+00:00 heroku[api]: Deploy 83dff7d by kelvintgx@yahoo.com
2015-02-07T08:30:25.316324+00:00 heroku[api]: Release v13 created by kelvintgx@yahoo.com
我也试过 heroku ps:scale web=1 命令:
Scaling dynos... failed
! No such process type web defined in Procfile.
python代码(在名为index.py的文件中):
from flask import Flask, make_response, request, json
import json
app = Flask(__name__)
@app.route('/test', methods = ['POST'])
def test():
resultJson = json.dumps(request.get_json())
response = app.response_class(resultJson, mimetype = 'application/json')
return response
if __name__ == '__main__':
app.debug = True
app.run(host='0.0.0.0')
Procfile:
web:gunicorn app:app
(我已经按照dirn的建议将Procfile内容修改为web:gunicorn index:app,但是错误依旧。)
requirements.txt :
Flask>=0.9
Jinja2>=2.7.2
Werkzeug>=0.9.4
gunicorn>=18.0
由于我对这些东西是新手,所以我只是复制并粘贴别人的Procfile和requirements.txt .
所有文件都在一个目录中。
本地环境下,我只要打开终端,运行命令:python~/index.py,终端显示:
* Running on http://0.0.0.0:5000/
* Restarting with reloader
然后一切正常。从客户端应用程序,我可以 post 到 url:http://0.0.0.0:5000/test 一些 json 数据,客户端应用程序将收到相同的 json 数据。
我不知道如何修复它。我只想 运行 服务器中的这个脚本,并且该脚本可以响应来自 Internet 的客户端应用程序请求。
问题出在您的 Procfile
上。
web:gunicorn app:app
这告诉 gunicorn 运行 名为 app
的 WSGI 应用程序可以在名为 app
的模块或包中找到。但是,您的模块名为 index
。
您可以将 index.py
重命名为 app.py
或将 Procfile
的内容更改为
web:gunicorn index:app
我是 python 和 Flask 的新手。 flask 的文档说您可以将您的应用程序部署到 heroku 以获得 public 访问权限。所以我转向了 heroku 网站。我一步一步地按照入门指南进行操作。我成功部署了应用程序,但是当我使用给定的 url 测试时,比如 https://mighty-falls-2223.heroku.com/,它说有错误。
错误信息是:
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
我尝试了 heroku logs 命令:
2015-02-06T05:05:23.598482+00:00 heroku[api]: Release v2 created by kelvintgx@yahoo.com
2015-02-06T05:05:23.598482+00:00 heroku[api]: Enable Logplex by kelvintgx@yahoo.com
2015-02-06T05:43:45.975680+00:00 heroku[api]: Deploy 6c41484 by kelvintgx@yahoo.com
2015-02-06T05:43:45.975680+00:00 heroku[api]: Release v3 created by kelvintgx@yahoo.com
2015-02-06T05:45:21.762316+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=a2351725-38cb-4480-a97a-b9cf84b1c8ec fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T05:45:24.285661+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mighty-falls-2323.herokuapp.com request_id=80d64b3a-3da7-4836-a653-0040b43acd0a fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T05:45:58.722807+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/" host=mighty-falls-2323.herokuapp.com request_id=5864f9d0-f4cb-438d-acc6-74c1afb05188 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T05:46:20.066306+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=1b62f73b-3240-4428-bc77-112801685486 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T05:47:57.279689+00:00 heroku[api]: Deploy 6c41484 by kelvintgx@yahoo.com
2015-02-06T05:47:57.279689+00:00 heroku[api]: Release v4 created by kelvintgx@yahoo.com
2015-02-06T06:02:22.868450+00:00 heroku[api]: Release v5 created by kelvintgx@yahoo.com
2015-02-06T06:02:22.868450+00:00 heroku[api]: Deploy 38003ed by kelvintgx@yahoo.com
2015-02-06T06:02:41.211691+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=0be3ab2e-e3d3-4186-8ae2-fddcd5919f11 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T06:03:12.755692+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=dbdcb909-ee4a-4c37-ade0-a2f38d9bad3e fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T06:03:58.407684+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=52d528be-0e19-491d-b80f-a6ed468a687c fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T06:08:41.991908+00:00 heroku[api]: Deploy 9d0211e by kelvintgx@yahoo.com
2015-02-06T06:08:41.991908+00:00 heroku[api]: Release v6 created by kelvintgx@yahoo.com
2015-02-06T06:09:11.138002+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=c2164d36-0c85-43fb-87d0-d637b011116e fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-06T06:09:37.362330+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=49c04057-1a7b-432d-a8a8-7d5687b717d1 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-06T06:10:15.040200+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/index.py/test" host=mighty-falls-2323.herokuapp.com request_id=ef7a49b4-fc15-4876-ae0a-30c866fb6ccd fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T08:03:09.470102+00:00 heroku[api]: Release v7 created by kelvintgx@yahoo.com
2015-02-06T08:03:09.470102+00:00 heroku[api]: Deploy 9d0211e by kelvintgx@yahoo.com
2015-02-06T08:03:38.874551+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=3e7ebf43-d55f-4831-98ee-3758957c6110 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-06T10:21:31.070674+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=8c2a7f5b-3382-4685-9e50-8415fbfc8703 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-06T10:25:42.879279+00:00 heroku[api]: Starting process with command
false && 自动诊断 运行 由 HEROKU 支持; cat Procfileby kelvintgx@yahoo.com
2015-02-06T10:25:46.887330+00:00 heroku[run.4361]: Awaiting client
2015-02-06T10:25:46.921078+00:00 heroku[run.4361]: Starting process with command
false && 自动诊断 运行 由 HEROKU 支持; cat Procfile
2015-02-06T10:25:48.553909+00:00 heroku[api]: Starting process with command
false && 自动诊断 运行 由 HEROKU 支持; cat requirements.txtby kelvintgx@yahoo.com
2015-02-06T10:25:47.174906+00:00 heroku[run.4361]: State changed from starting to up
2015-02-06T10:25:49.052088+00:00 heroku[run.4361]: Process exited with status 0
2015-02-06T10:25:49.061559+00:00 heroku[run.4361]: State changed from up to complete
2015-02-06T10:25:55.154435+00:00 heroku[run.5301]: Awaiting client
2015-02-06T10:25:55.187005+00:00 heroku[run.5301]: Starting process with command
false && 自动诊断 运行 由 HEROKU 支持; cat requirements.txt
2015-02-06T10:25:55.608338+00:00 heroku[run.5301]: State changed from starting to up
2015-02-06T10:25:57.225198+00:00 heroku[run.5301]: Process exited with status 0
2015-02-06T10:25:57.237272+00:00 heroku[run.5301]: State changed from up to complete
2015-02-06T10:41:02.655049+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=88ad749c-b3c0-41da-8522-052c25beaa58 fwd="82.227.198.77" dyno= connect= service= status=503 bytes=
2015-02-06T10:41:02.986494+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mighty-falls-2323.herokuapp.com request_id=3cb538b8-7020-49c5-8d5f-4752ed41bf17 fwd="82.227.198.77" dyno= connect= service= status=503 bytes=
2015-02-06T10:41:14.129885+00:00 heroku[api]: Starting process with command
bashby damien@heroku.com
2015-02-06T10:41:18.300710+00:00 heroku[run.5301]: Awaiting client
2015-02-06T10:41:18.335348+00:00 heroku[run.5301]: Starting process with command
bash
2015-02-06T10:41:18.590203+00:00 heroku[run.5301]: State changed from starting to up
2015-02-06T10:41:23.138727+00:00 heroku[run.5301]: Process exited with status 0
2015-02-06T10:41:23.148562+00:00 heroku[run.5301]: State changed from up to complete
2015-02-06T13:37:04.131811+00:00 heroku[api]: Starting process with command
cat Procfileby johnb@heroku.com
2015-02-06T13:37:08.374192+00:00 heroku[run.3797]: Starting process with command
cat Procfile
2015-02-06T13:37:08.338415+00:00 heroku[run.3797]: Awaiting client
2015-02-06T13:37:08.560954+00:00 heroku[run.3797]: State changed from starting to up
2015-02-06T13:37:10.089507+00:00 heroku[run.3797]: Process exited with status 0
2015-02-06T13:37:10.113779+00:00 heroku[run.3797]: State changed from up to complete
2015-02-06T23:48:45.731958+00:00 heroku[api]: Deploy 6b11519 by kelvintgx@yahoo.com
2015-02-06T23:48:45.731958+00:00 heroku[api]: Release v8 created by kelvintgx@yahoo.com
2015-02-07T00:09:59.480138+00:00 heroku[api]: Release v9 created by kelvintgx@yahoo.com
2015-02-07T00:09:59.480138+00:00 heroku[api]: Deploy 6b11519 by kelvintgx@yahoo.com
2015-02-07T00:10:48.844680+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=7d1f4f4f-ef77-463c-a7ea-b8f324a659e7 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:10:50.372417+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mighty-falls-2323.herokuapp.com request_id=cb478ca0-26db-4190-a352-73fac8e593bf fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:11:20.708121+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=257aa4ce-fcc5-478a-866e-16b5e06e6b28 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T00:25:01.892151+00:00 heroku[api]: Release v10 created by kelvintgx@yahoo.com
2015-02-07T00:25:01.892151+00:00 heroku[api]: Deploy f656bf6 by kelvintgx@yahoo.com
2015-02-07T00:25:15.504015+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=ef792387-7275-473a-94a4-fd6d79193606 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:25:16.299068+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mighty-falls-2323.herokuapp.com request_id=4bc9fe23-ef1c-4558-8dbc-e7a076184251 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:26:58.704016+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=2d0d428b-6e82-4fba-8bca-62b165dc9a8a fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:26:59.276275+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=56f32a41-ca5d-4177-af86-b5be5122e1a0 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:26:59.401230+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=3c74db5e-a184-43c6-8509-6d2652f98ad5 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:26:59.759710+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=ddb0c3bf-d037-4e88-91d0-527c3bdc5294 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:27:00.002293+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=b8213dc4-68f9-4506-9df3-8f8d9d84c17e fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:27:00.200540+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=4c3972ce-cf8d-455a-9642-fb7ab27614ab fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T00:27:31.036773+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=7d8cd1cf-047c-4f31-a77a-67d2fd407f3e fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T00:38:10.241481+00:00 heroku[api]: Deploy bce1b94 by kelvintgx@yahoo.com
2015-02-07T00:38:10.241481+00:00 heroku[api]: Release v11 created by kelvintgx@yahoo.com
2015-02-07T00:47:15.189446+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=d1e0f728-f37d-4bbc-934d-710a1bc6c038 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T00:47:16.032290+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=mighty-falls-2323.herokuapp.com request_id=922e5bee-44c7-4175-b04a-c678ea892c49 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T05:39:16.650160+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=20cda673-a9d5-4235-8c56-7d4ade42d3af fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T05:42:18.957812+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/test" host=mighty-falls-2323.herokuapp.com request_id=21b650da-b678-4e0f-b25c-07ce57dade4a fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T05:42:30.441817+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=736b31a0-54bd-426e-b139-82e9e3b59cfb fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T05:43:17.115422+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=cf5fc45d-7de3-4ceb-9ddb-e0359e9bee7e fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T05:43:28.889811+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=c28de66f-47fc-43e2-ba31-2cc9f75b60e7 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T05:45:00.848077+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/equations" host=mighty-falls-2323.herokuapp.com request_id=fa17ce1f-3fdf-4d6f-93af-00b4182f39d8 fwd="223.66.226.41" dyno= connect= service= status=503 bytes=
2015-02-07T08:27:44.307547+00:00 heroku[api]: Deploy 83dff7d by kelvintgx@yahoo.com
2015-02-07T08:27:44.307703+00:00 heroku[api]: Release v12 created by kelvintgx@yahoo.com
2015-02-07T08:28:22.236893+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=f42d825a-11ab-429b-8f37-cf1c2e2fa891 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T08:28:38.028373+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/test" host=mighty-falls-2323.herokuapp.com request_id=04e4cf42-ef58-44a4-92d7-5a62598260d7 fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T08:29:15.618833+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=mighty-falls-2323.herokuapp.com request_id=869ae9c3-4132-43d6-b84b-f8a4ea47375f fwd="223.66.227.40" dyno= connect= service= status=503 bytes=
2015-02-07T08:30:25.316324+00:00 heroku[api]: Deploy 83dff7d by kelvintgx@yahoo.com
2015-02-07T08:30:25.316324+00:00 heroku[api]: Release v13 created by kelvintgx@yahoo.com
我也试过 heroku ps:scale web=1 命令:
Scaling dynos... failed
! No such process type web defined in Procfile.
python代码(在名为index.py的文件中):
from flask import Flask, make_response, request, json
import json
app = Flask(__name__)
@app.route('/test', methods = ['POST'])
def test():
resultJson = json.dumps(request.get_json())
response = app.response_class(resultJson, mimetype = 'application/json')
return response
if __name__ == '__main__':
app.debug = True
app.run(host='0.0.0.0')
Procfile:
web:gunicorn app:app
(我已经按照dirn的建议将Procfile内容修改为web:gunicorn index:app,但是错误依旧。)
requirements.txt :
Flask>=0.9
Jinja2>=2.7.2
Werkzeug>=0.9.4
gunicorn>=18.0
由于我对这些东西是新手,所以我只是复制并粘贴别人的Procfile和requirements.txt .
所有文件都在一个目录中。
本地环境下,我只要打开终端,运行命令:python~/index.py,终端显示:
* Running on http://0.0.0.0:5000/
* Restarting with reloader
然后一切正常。从客户端应用程序,我可以 post 到 url:http://0.0.0.0:5000/test 一些 json 数据,客户端应用程序将收到相同的 json 数据。
我不知道如何修复它。我只想 运行 服务器中的这个脚本,并且该脚本可以响应来自 Internet 的客户端应用程序请求。
问题出在您的 Procfile
上。
web:gunicorn app:app
这告诉 gunicorn 运行 名为 app
的 WSGI 应用程序可以在名为 app
的模块或包中找到。但是,您的模块名为 index
。
您可以将 index.py
重命名为 app.py
或将 Procfile
的内容更改为
web:gunicorn index:app