Django H14 Heroku error, how do i fix this? - django

2020-09-08T17:05:06.205027+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=uvdocdash.herokuapp.com request_id=f17ceaee-3e7c-4eba-aebf-19dd4b424eee fwd="70.39.71.29" dyno= connect= service= status=503 bytes= protocol=https
I get this error in the logs, so far I havent been able to find out why my app isnt working. It's a django app, and the requirments.txt is correct as far as i know.
asgiref==3.2.10
Django==3.1.1
gunicorn==20.0.4
pytz==2020.1
sqlparse==0.3.1
django-heroku >= 0.3.1

Add a Procfile to your folder that has manage.py in it. Just add a file called Procfile and add web: gunicorn projectname.wsgi inside of that file. save and push.

Related

Application error on deployed django rest framework app on heroku

I'm trying to deploy my django rest framework app on Heroku. I read many other similar questions but I'm confused. My app structure is not right or I'm missing something.
This is my structure on git:
.gitignore
requirements.txt
src
|
--authorization
--core
--static
--staticfiles
--Procfile
--manage.py
--suacm
|
---asgi.py
---settings.py
---urls.py
---wsgi.py
authorization and core are apps under my django project. there wasn't static or staticfiles before heroku deploy. But it automatically created staticfiles. Then I also created static and followed instructions to make it work via changes in settings.py. It'd be awesome if someone help me figure out my problem on heroku and why it doesn't work.
This is Procfile:
web: gunicorn suacm.wsgi
web: gunicorn suacm:app
When I run app with this command my app works fine and run locally:
gunicorn suacm.wsgi:application
But I couldn't solve the error in deployed app.
With
heroku logs --tail
I receive errors starts like below:
2021-05-21T14:32:20.000000+00:00 app[api]: Build succeeded
2021-05-21T14:32:26.505788+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=suacm.herokuapp.com request_id=dfeba2ff-fa7d-4dfb-9337-706f50d286dc fwd="82.222.237.15" dyno= connect= service= status=503 bytes= protocol=https
2021-05-21T14:32:26.882608+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=suacm.herokuapp.com request_id=292525ae-bc4e-49c7-b979-e455bbfd6b95 fwd="82.222.237.15" dyno= connect= service= status=503 bytes= protocol=https
When I run this
heroku ps:scale web=1 --app suacm
I get this:
Scaling dynos... !
▸ Couldn't find that process type (web).
And finally when I try to run heroku locally under src folder with this command
src % heroku local web
I get this response:
[INFO] Starting gunicorn 20.1.0
[INFO] Listening at: http://0.0.0.0:5000 (35246)
[INFO] Using worker: sync
[INFO] Booting worker with pid: 35247
Failed to find attribute 'app' in 'suacm'.
[INFO] Worker exiting (pid: 35247)
.
.
If needed, this is my requirements.txt file:
django_environ==0.4.5
djangorestframework_simplejwt==4.6.0
django_filter==2.4.0
Django==3.1.3
djangorestframework==3.12.4
environ==1.0
PyJWT==2.1.0
gunicorn==20.1.0
django-on-heroku==1.1.2
whitenoise==5.2.0
This is my first time deploying a django app. I hope I gave enough information. Just ask if there is more information needed.
Put your Procfile in the root directory, not in the src and
change this
web: gunicorn suacm.wsgi
to
web: gunicorn src.suacm.wsgi
Then why it work on a local server?
In your local setup, you are launching the server from the src directory which is not the root directory!
But the in the production Heroku launches the application from the root directory, since there is no Procfile in the root directory you are getting these errors.

Django on Heroku. No web processes running

I have a Django app which works when I run it locally heroku local. When I push my code to heroku git push heroku main it pushes without any problem, but when I opening my site it showes an 503 error in console
1 GET https://XXX.herokuapp.com/ 503 (Service Unavailable)
inside my logs I get this
at=error code=H14 desc="No web processes running" method=GET path="/" host=omylibrary.herokuapp.com request_id=lotofnumbers fwd="somenumbers" dyno= connect= service= status=503 bytes= protocol=https
from this question I assume that the problem is in ProcFile if more precisely in web. My Procfile looks like this
web: gunicorn --chdir ./Lib library.wsgi --log-file -
I also tried this
heroku ps:scale web=1
from previous answer. What Is wrong here ?
also heroku ps returns No dynos on mysite
The problem was that I named ProcFile instead of Procfile I found the solution here I have checked logs of heroku while pushing my app by terminal and I got
remote: Procfile declares types -> (none)
so if you don't have web process running probably it's because of procfile or the code inside it

Heroku logs says: "No web processes running"

I made a website with django and tried deploying it using Heroku. After deploying, I can't access to it and Heroku log shows the following error :
at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=pur-beurre-oc8.herokuapp.com request_id=9e33d4c8-83d6-4214-baf8-e4d1023b43ff fwd="176.134.6.63" dyno= connect= service= status=503 bytes= protocol=https
After looking through some similar problems, I tried:
heroku ps:scale web=1
and got:
Scaling dynos... !
▸ Couldn't find that process type (web).
I tried to remove and add buildpacks:
heroku buildpacks:clear
heroku buildpacks:add --index heroku/python
but this last command return to me:
Error: Expected an integer but received: heroku/python
at Object.parse (/snap/heroku/3832/node_modules/#oclif/parser/lib/flags.js:17:19)
at Parser._flags (/snap/heroku/3832/node_modules/#oclif/parser/lib/parse.js:152:49)
at Parser.parse (/snap/heroku/3832/node_modules/#oclif/parser/lib/parse.js:113:28)
at Object.parse (/snap/heroku/3832/node_modules/#oclif/parser/lib/index.js:25:27)
at Add.parse (/snap/heroku/3832/node_modules/#oclif/command/lib/command.js:83:41)
at Add.run (/snap/heroku/3832/node_modules/#heroku-cli/plugin-buildpacks/lib/commands/buildpacks/add.js:7:36)
at Add._run (/snap/heroku/3832/node_modules/#oclif/command/lib/command.js:44:31)
So I do not know what I'm doing wrong
My Proficle is like this:
web: gunicorn pur_beurre.wsgi
I tried to change Procfile like this:
web: gunicorn pur_beurre:app
or this:
web gunicorn pur_beurre:app
but heroku ps:scale web=1 still not working
Edit
My Procfile was not in my app’s root directory, so I moved it and now heroku ps:scale web=1 returns:
Scaling dynos... done, now running web at 1:Free
But I still have the error:
at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=pur-beurre-oc8.herokuapp.com request_id=8cc800fa-cd49-43a9-8fc5-babf0028ca1f fwd="176.134.6.63" dyno= connect= service= status=503 bytes= protocol=https

Django Heroku H10 error method=GET path="/favicon.ico"

I am fighting with this error while trying to get Django app to Heroku.
Below some details:
Requirements:
dj-database-url==0.5.0
Django==2.1.5
django-heroku==0.3.1
gunicorn==19.9.0
psycopg2==2.7.7
psycopg2-binary==2.7.6.1
pytz==2018.9
whitenoise==4.1.2
WSGI:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "folder.settings")
application = get_wsgi_application()
Procfile tried (below are options i used in separate files/deployment):
web: gunicorn 4_Django/folder/wsgi.py 0.0.0.0:$PORT
LOGs:
Procfile logs:
2019-01-29T14:18:23.785257+00:00 heroku[web.1]: Starting process with
command `gunicorn 4_Django/folder/wsgi.py 0.0.0.0:8023`
2019-01-29T14:18:26.388317+00:00 heroku[web.1]: State changed from
starting to crashed
2019-01-29T14:18:26.307448+00:00 heroku[web.1]: Process exited with
status 3
2019-01-29T14:18:27.000000+00:00 app[api]: Build succeeded
2019-01-29T14:18:32.222748+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/favicon.ico"
host=djangozadanie.herokuapp.com request_id=7102a7b5-2798-4317-988d-
a690c10c9a14 fwd="89.78.65.77" dyno= connect= service= status=503
bytes= protocol=https
During deployment i get dozen of lines like the below, but i am not sure it has anythong to do with the problem:
Found another file with the destination path 'style.css'. It will be
ignored since only the first encountered file is collected. If this is
not what you want, make sure every static file has a unique path.
That's not how you use gunicorn. It accepts a Python module path, not a file path, and doesn't take an IP or port on the command line.
As the docs show, actually all you need is just:
web: gunicorn folder.wsgi
assuming folder is your project name.

django project with heroku: application error

I successfully deploy the project to Heroku. but when I run Heroku open it throws Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.
my logs is here
(dj12) λ heroku logs
2018-07-05T07:06:17.443987+00:00 app[api]: Initial release by user ermiaskidanegebre#gmail.com
2018-07-05T07:06:17.443987+00:00 app[api]: Release v1 created by user ermiaskidanegebre#gmail.com
2018-07-05T07:06:17.909289+00:00 app[api]: Release v2 created by user ermiaskidanegebre#gmail.com
2018-07-05T07:06:17.909289+00:00 app[api]: Enable Logplex by user ermiaskidanegebre#gmail.com
2018-07-05T07:16:35.051508+00:00 app[api]: Attach DATABASE (#ref:postgresql-shaped-50056) by user ermiaskidanegebre#gmail.com
2018-07-05T07:16:35.051508+00:00 app[api]: Release v3 created by user ermiaskidanegebre#gmail.com
2018-07-05T07:24:48.143580+00:00 app[api]: Set SECRET_KEY config vars by user ermiaskidanegebre#gmail.com
2018-07-05T07:24:48.143580+00:00 app[api]: Release v4 created by user ermiaskidanegebre#gmail.com
2018-07-05T07:33:04.050618+00:00 app[api]: Set SECRET_KEY config vars by user ermiaskidanegebre#gmail.com
2018-07-05T07:33:04.050618+00:00 app[api]: Release v5 created by user ermiaskidanegebre#gmail.com
2018-07-05T07:40:34.881810+00:00 app[api]: Set EMAIL_PASSWORD config vars by user ermiaskidanegebre#gmail.com
2018-07-05T07:40:34.881810+00:00 app[api]: Release v6 created by user ermiaskidanegebre#gmail.com
2018-07-05T07:49:13.302208+00:00 app[api]: Release v7 created by user ermiaskidanegebre#gmail.com
2018-07-05T07:49:13.302208+00:00 app[api]: Set DISABLE_COLLECTSTATIC config vars by user ermiaskidanegebre#gmail.com
2018-07-05T07:54:43.000000+00:00 app[api]: Build started by user ermiaskidanegebre#gmail.com
2018-07-05T07:55:09.406852+00:00 app[api]: Release v8 created by user ermiaskidanegebre#gmail.com
2018-07-05T07:55:09.406852+00:00 app[api]: Deploy 2fdb68de by user ermiaskidanegebre#gmail.com
2018-07-05T07:55:18.000000+00:00 app[api]: Build succeeded
2018-07-05T07:57:14.239360+00:00 app[api]: Starting process with command `python manage.py migrate` by user ermiaskidanegebre#gmail.com
2018-07-05T07:57:20.853528+00:00 heroku[run.2986]: State changed from starting to up
2018-07-05T07:57:20.965558+00:00 heroku[run.2986]: Awaiting client
2018-07-05T07:57:21.013142+00:00 heroku[run.2986]: Starting process with command `python manage.py migrate`
2018-07-05T07:57:26.012552+00:00 heroku[run.2986]: Process exited with status 1
2018-07-05T07:57:26.032134+00:00 heroku[run.2986]: State changed from up to complete
2018-07-05T08:01:58.000000+00:00 app[api]: Build started by user ermiaskidanegebre#gmail.com
2018-07-05T08:02:15.941485+00:00 app[api]: Release v9 created by user ermiaskidanegebre#gmail.com
2018-07-05T08:02:15.941485+00:00 app[api]: Deploy 8a0e03de by user ermiaskidanegebre#gmail.com
2018-07-05T08:02:25.000000+00:00 app[api]: Build succeeded
2018-07-05T08:03:43.462294+00:00 heroku[run.1120]: Awaiting client
2018-07-05T08:03:43.510884+00:00 heroku[run.1120]: Starting process with command `python manage.py migrate`
2018-07-05T08:03:43.859691+00:00 heroku[run.1120]: State changed from starting to up
2018-07-05T08:03:37.888541+00:00 app[api]: Starting process with command `python manage.py migrate` by user ermiaskidanegebre#gmail.com
2018-07-05T08:03:53.506152+00:00 heroku[run.1120]: Process exited with status 0
2018-07-05T08:03:53.525335+00:00 heroku[run.1120]: State changed from up to complete
2018-07-05T08:13:52.212453+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=750bffb9-e6bb-4ea7-94bd-09772529bf3c fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T08:13:52.636447+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=django-ecommerce-2.herokuapp.com request_id=be57a379-0d82-4251-9218-049d3cdfb9a6 fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T08:57:48.239032+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=e5708b4e-1ef6-4167-a70a-0a99c9b8aecf fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T08:57:48.702316+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=django-ecommerce-2.herokuapp.com request_id=d92730e4-c5e9-4570-a709-311a07e0e3dc fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T09:11:36.000000+00:00 app[api]: Build started by user ermiaskidanegebre#gmail.com
2018-07-05T09:11:53.696459+00:00 app[api]: Deploy 2993315c by user ermiaskidanegebre#gmail.com
2018-07-05T09:11:53.696459+00:00 app[api]: Release v10 created by user ermiaskidanegebre#gmail.com
2018-07-05T09:12:03.000000+00:00 app[api]: Build succeeded
2018-07-05T09:32:26.285646+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=08b476e4-c7f9-43b4-b706-9d44d3b8c8c1 fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T09:32:55.648599+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=5e4b151f-757b-49ad-8138-c47877c2c3e1 fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T11:09:37.172582+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=ea6c2402-cfe2-4cb5-a910-2b6d152174f4 fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T11:10:05.085667+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=f91cef75-167c-4160-8709-e73736384dbc fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T11:10:06.448716+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=django-ecommerce-2.herokuapp.com request_id=5fa29e24-e3d1-439f-bf88-dd1f266ac85a fwd="82.26.20.87" dyno= connect= service= status=503 bytes= protocol=https
2018-07-05T11:22:38.501221+00:00 app[api]: Starting process with command `bash` by user ermiaskidanegebre#gmail.com
2018-07-05T11:22:43.651327+00:00 heroku[run.8345]: Awaiting client
2018-07-05T11:22:43.684186+00:00 heroku[run.8345]: Starting process with command `bash`
2018-07-05T11:22:43.729572+00:00 heroku[run.8345]: State changed from starting to up
2018-07-05T11:29:31.865357+00:00 heroku[run.8345]: Process exited with status 127
2018-07-05T11:29:32.006562+00:00 heroku[run.8345]: State changed from up to complete
my procfile
"web: gunicorn ecommerce2.wsgi"
my wsgi.py
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ecommerce2.settings")
application = get_wsgi_application()
and from the documentation errors related to H14 can be fixed with heroku ps:scale web=1 and this pop out
Scaling dynos... !
! Couldn't find that process type.
when I check my Heroku account the Dynos in the resource is saying the below tex, eventhough I added my Procfile successfully.
This app has no process types yet
Add a Procfile to your app in order to define its process types. Learn more
how could I fix this issue?
thanks for your help.
Last time when I had this issue it was related to requirement not found. update your requirements.txt file from your local.
Also what you want to do is in your settings.py
DEBUG = False
DEBUG_PROPAGATE_EXCEPTIONS = True
Add these lines for production. This will propogate error to log. There you can see why you are getting application error.
(I am willing to bet its a some missing package. Let me know what it was.)
Your app doesn't have any process running.
You need to scale your web dyno with the heroku ps:scale web=1 command.
Of course, this assumes you have configured a web process type in your Procfile.
Today I faced the same error. In my root directory, I had Procfile without any extention but when I opened the code in visual studio code, the Procfile had the extension .txt and was present as "Procfile.txt". I just removed the .txt from the file and saved it. This resolved my error.
You can refer to my post for more clarification:
Getting application error while running the python app on heroku