Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 1000
arjun gulyani Avatar asked Aug 31 '16 16:08

arjun gulyani


3 Answers

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

like image 149
Stefan Avatar answered Oct 21 '22 10:10

Stefan


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.

like image 25
Scott Eifel Avatar answered Oct 21 '22 08:10

Scott Eifel


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.

like image 2
biocyberman Avatar answered Oct 21 '22 09:10

biocyberman