Heroku - No web process running

别等时光非礼了梦想. 提交于 2020-06-09 16:57:10

问题


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.


回答1:


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




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/39254597/heroku-no-web-process-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!