baisbdhfug
baisbdhfug

Reputation: 588

Django website deployed on heroku does not work

I created a django website and was trying to deploy it to heroku. I followed this tutorial and did everything he did but i'm getting these errors in the logs

2020-07-10T02:06:01.015381+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=website.herokuapp.com request_id=9efff235-77f8-41e8-bc9e-9f80bd2b6aa1 fwd="172.98.86.231" dyno= connect= service= status=503 bytes= protocol=https

2020-07-10T02:06:01.743381+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=website.herokuapp.com request_id=bf2f44a0-8f5c-4e63-a1c9-e16a33761803 fwd="172.98.86.231" dyno= connect= service= status=503 bytes= protocol=https

my procfile has these contents

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

my requirements.txt includes these

asgiref==3.2.3
Django==2.1.7
pytz==2019.3
sqlparse==0.3.0
SQLAlchemy==1.3.9
psycopg2==2.8.4
Jinja2==2.10.3
gunicorn==20.0.4

I used to get the same HTTP errors when running the site locally but the site used to render and work properly. I'm getting the same error in heroku but site is not working

Can someone explain what these error means and how to fix them or you could also reply with a link to a video or documentation you used to deploy your website and worked

Upvotes: 1

Views: 774

Answers (3)

Hayotbek
Hayotbek

Reputation: 1

I faced the same problem and the problem was simple: I forgot to put gunicorn to requirements.txt, so the heroku server did not install the needed package. I added gunicorn to requirements.txt, pushed again, and it worked for me!

Upvotes: 0

baisbdhfug
baisbdhfug

Reputation: 588

I figured it out. In my case I renamed the "procfile" to "Procfile" updated the contents of the procfile to

web: gunicorn website.wsgi:application --log-file -
python manage.py collectstatic --noinput
manage.py migrate

and this worked

Upvotes: 1

Aayush Agrawal
Aayush Agrawal

Reputation: 1394

You are facing this problem because Gunicorn is not running.

Try running this command on your local computer: "gunicorn website.wsgi --log-file - " does it run?

Are there any build errors from Heroku?

Upvotes: 0

Related Questions