What is the correct way to add dynos to Django/Heroku project?

368 Views Asked by At

This is continuation of my previous question: What is the propper way to debug gunicorn?

Currently I am having error code=H14 desc="No web processes running" wihch suggests that there are no dynos. I tried to fix this by doing heroku ps:scale web=1, but instead got error: Scaling dynos... ! ▸ Couldn't find that process type (web).. This answer suggests "simple disable/enable through heroku dashboard". However I can't see any way I can do that. Some other possible solutions suggested that the problem is with the Procfile, its location or its content.

Here is my Procfile

web: gunicorn kauppalista.wsgi --log-file -

Here is my folder structure:

folder my_project
│   requirements.txt
│   runtime.txt
│   folder .git
│   folder my_project-env
│
└───folder my_project
│   │   folder my_project (main Django app)
│   │   folder django app 1
│   │   folder django app 2
│   │   manage.py
│   │   Procfile

EDIT:

I also tried moving Procfile one folder up in hierarcy (to same as requirements.txt). At the same time changed Procfile reference to my_project.my_project.wsgi. This resulted in dynos to be available so something went right, but then got error: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

1

There are 1 best solutions below

3
eManuel On

Move the requirements.txt and the runtime.txt to the location where manage.py and Procfile is found in your folder structure because, they are all required to be in the project root.... See here

I also hope that the kauppalista.wsgi points to the main Django app. For instance, from the folder structure you provided, the wsgi.py file would be found inside this location: folder my_project > folder my_project > folder my_project(main Django app called kauppalista). So the Procfile would be;

web: gunicorn kauppalista.wsgi --log-file -

OR

web: gunicorn kauppalista.wsgi

Running the heroku ps command should also help you to determine the state of the dynos after you apply the changes. In the case it says 'no dyno on app', simply disable/enable dynos through the heroku dashboard by loggin in via your web browser.

Remember to add, commit and push your changes to heroku.