0

I'm new to python and flask. The flask's document says you can deploy your app to heroku for public access. So I turned to heroku site. I followed the getting started guide step by step. I deployed the app successfully, but when I tested with the given url like https://mighty-falls-2223.heroku.com/, it said there was error.

The error message is:

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.

I tried heroku logs command:

2015-02-06T05:05:23.598482+00:00 heroku[api]: Release v2 created by [email protected] 2015-02-06T05:05:23.598482+00:00 heroku[api]: Enable Logplex by [email protected] 2015-02-06T05:43:45.975680+00:00 heroku[api]: Deploy 6c41484 by [email protected] 2015-02-06T05:43:45.975680+00:00 heroku[api]: Release v3 created by [email protected] 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 [email protected] 2015-02-06T05:47:57.279689+00:00 heroku[api]: Release v4 created by [email protected] 2015-02-06T06:02:22.868450+00:00 heroku[api]: Release v5 created by [email protected] 2015-02-06T06:02:22.868450+00:00 heroku[api]: Deploy 38003ed by [email protected] 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 [email protected] 2015-02-06T06:08:41.991908+00:00 heroku[api]: Release v6 created by [email protected] 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 [email protected] 2015-02-06T08:03:09.470102+00:00 heroku[api]: Deploy 9d0211e by [email protected] 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 commandfalse && AUTOMATED DIAGNOSIS BEING RUN BY HEROKU SUPPORT; cat Procfileby [email protected] 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 commandfalse && AUTOMATED DIAGNOSIS BEING RUN BY HEROKU SUPPORT; cat Procfile 2015-02-06T10:25:48.553909+00:00 heroku[api]: Starting process with commandfalse && AUTOMATED DIAGNOSIS BEING RUN BY HEROKU SUPPORT; cat requirements.txtby [email protected] 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 commandfalse && AUTOMATED DIAGNOSIS BEING RUN BY HEROKU SUPPORT; 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 commandbashby [email protected] 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 commandbash 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 commandcat Procfileby [email protected] 2015-02-06T13:37:08.374192+00:00 heroku[run.3797]: Starting process with commandcat 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 [email protected] 2015-02-06T23:48:45.731958+00:00 heroku[api]: Release v8 created by [email protected] 2015-02-07T00:09:59.480138+00:00 heroku[api]: Release v9 created by [email protected] 2015-02-07T00:09:59.480138+00:00 heroku[api]: Deploy 6b11519 by [email protected] 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 [email protected] 2015-02-07T00:25:01.892151+00:00 heroku[api]: Deploy f656bf6 by [email protected] 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 [email protected] 2015-02-07T00:38:10.241481+00:00 heroku[api]: Release v11 created by [email protected] 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 [email protected] 2015-02-07T08:27:44.307703+00:00 heroku[api]: Release v12 created by [email protected] 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 [email protected] 2015-02-07T08:30:25.316324+00:00 heroku[api]: Release v13 created by [email protected]

I also tried heroku ps:scale web=1 command:

Scaling dynos... failed ! No such process type web defined in Procfile.

the python code(in the file named 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')

the Procfile:

web:gunicorn app:app

(I have followed dirn's suggestion to change Procfile content to web:gunicorn index:app, But the error is still here.)

the requirements.txt :

Flask>=0.9
Jinja2>=2.7.2
Werkzeug>=0.9.4
gunicorn>=18.0

Since I am new to these things, so I just copy and paste others' Procfile and requirements.txt .

All the files are in one directory.

In the local environment, I just need to open terminal, and run command: python ~/index.py, and the terminal shows:

* Running on http://0.0.0.0:5000/
* Restarting with reloader

Then everything is working as it is. From the client app, I can post to url:http://0.0.0.0:5000/test with some json data, and the client app will receive the same json data.

I don't know how to fix it. I just want to run this script in a server and the script can response to the client app's request from the Internet.

1
  • I don't thinks it's relevant for your problem, but you should not run debug = True on a production system Commented Feb 6, 2015 at 12:06

1 Answer 1

1

The problem is with your Procfile.

web:gunicorn app:app

This tells gunicorn to run the WSGI application named app that can be found in a module or package named app. Your module, however, is named index.

You can either rename index.py to app.py or change the contents of your Procfile to

web:gunicorn index:app
Sign up to request clarification or add additional context in comments.

3 Comments

I have edited the Procfile with your suggestion, but the error is still here. Should I edit app.run(host='0.0.0.0') or maybe change index:app to app:index ?
What is the error? You didn't include it in your question.
I have fixed it by change the content of Procfile to web: gunicorn index:app There is a space between web: and gunicorn

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.