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

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.

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 site hosting on Heroku "No web processes runnng"

So I tried to host my Django application to Heroku and at first it worked. Then I wanted to add some release commands so I did this:
release_commands.sh
python manage.py makemigrations
python manage.py migrate
And in my Procfile:
release: bash ./release_commands.sh
web: gunicorn todo.wsgi --log-file -
The second line in my Procfile is unchanged, so I guessed that the error must be coming from the release commands, but that's not the case as in my heroku logs I have this:
2021-02-17T19:41:31.675215+00:00 heroku[release.6232]: Process exited with status 0
2021-02-17T19:41:31.772693+00:00 heroku[release.6232]: State changed from up to complete
2021-02-17T19:41:34.021990+00:00 app[api]: Release v11 created by user georgi.hr.dim#gmail.com
This is the error message:
2021-02-17T19:41:43.594322+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/accounts/login/?next=/" host=essentialtodo.herokuapp.com request_id=5dce4816-6343-44c3-9c8f
-171e79379abc fwd="78.90.0.206" dyno= connect= service= status=503 bytes= protocol=https
Just found out what the problem was. For some reason after adding the release commands my dynos were turned off. To fix this: go to your heroku app (on the heroku website) -> go to resources -> press the edit button on your dyno -> turn it on and confirm
.

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

Django H14 Heroku error, how do i fix this?

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.

Error R10 (Boot timeout) : Django app on heroku

I have been trying to deploy a django app on Heroku. But it is always failing with the following error (R10 timeout, failed to bind to PORT in 60 seconds). The app works absolutely fine when deployed locally. I have been able to configure the postgres db correctly on heroku (bootstrapped the data and checked the contents). But somehow my web application is not starting, as can be seen in the logs below.
I have tried setting up explicit port number, as suggested in some forums. But it didn't work.
Any idea what's going wrong ?
I have put the heroku logs below. My code is here, if it helps : https://github.com/solitaryreaper/sp_mysiswrites
Thanks.
2014-02-25T06:38:08.220957+00:00 app[web.1]: 0 errors found
2014-02-25T06:38:08.225056+00:00 app[web.1]: February 25, 2014 - 06:38:08
2014-02-25T06:38:08.225056+00:00 app[web.1]: Django version 1.6.2, using settings 'sisnewsarticles.settings'
2014-02-25T06:38:08.225056+00:00 app[web.1]: Starting development server at http://127.0.0.1:8000/
2014-02-25T06:38:08.225056+00:00 app[web.1]: Quit the server with CONTROL-C.
2014-02-25T06:39:06.941786+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2014-02-25T06:39:06.942022+00:00 heroku[web.1]: Stopping process with SIGKILL
2014-02-25T06:39:08.171526+00:00 heroku[web.1]: Process exited with status 137
2014-02-25T06:39:08.179601+00:00 heroku[web.1]: State changed from starting to crashed
2014-02-25T06:39:11.684273+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/enews/ host=barkha-writes.herokuapp.com request_id=65c9cb99-c629-46b5-9dd7-fed5c9bfdc13 fwd="24.240.36.207" dyno= connect= service= status=503 bytes=
Change your Procfile according to documentation given on Heroku.
Also add gunicorn to INSTALLED_APPS in settings.py
your Procfile look like
"web: gunicorn path/of/yourwsgit/file.wsgi"
your wsgi script look like this.
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
application = Cling(get_wsgi_application())