简体   繁体   中英

Heroku - No web process running

I made a twitter bot using tweepy in Python and tried deploying it using Heroku. The Bot just tweets after certain intervals. After deploying it, the Python program just doesn't run and Heroku log shows the following error :

at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=fathomless-island-25537.herokuapp.com request_id=0aa76d12-31e6-4940-85ec-a8476af4f82f fwd="182.64.210.145" dyno= connect= service= status=503 bytes=

After looking through some similar problems where a django app has to be deployed, I tried:

heroku ps:scale web=1

and got:

Scaling dynos... !
 !  Couldn't find that formation.

Does it mean that the program failed to establish a web process or is there something else related to dynos ? Or if I have to include some code related to dynos in my program ? I don't know which part of this whole process has a problem. Apologies if it's too basic.

The question is a bit older, but anyway...

Before you can scale the dynos, you need to have a Procfile, where you define what should happen when the process is started. In your case the process should be called web . We'll come the the content of the file in a moment.

But first: To me it seems best to use gunicorn for running python apps on heroku, so first you should install gunicorn, run pip freeze > requirements.txt and push it to heroku (well, wait with that until you have the Procfile). For more see: python with gunicorn on heroku

The Procfile only needs one line web: gunicorn <filename>:<main method name> . In your case this would be (assuming your main method is called 'app') web: gunicorn bot:app .

Now push all that to heroku, then you can scale your dyno with the command you used heroku ps:scale web=1

When you try heroku ps:scale web=1 and everything else in vain, check that you have Procfile with correct name and content. I had a problem with it. After fixing the name and content, and pushing the update to heroku, the app started by itself. After that heroku open works as expected.

I was having trouble getting my app to load, until I modified my Procfile

from saying

web: gunicorn app:app

to

web gunicorn app:app

Removing the : after web made it work for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM