11 Answers11

24

Check the logs of your Heroku application to see more details. You can stream the log using the Heroku CLI after logging in:

heroku logs -t

Alternatively, you can view the logs on the app dashboard.

Brandon DeRosier
  • 861
  • 5
  • 15
2

Apparently, I was being displayed the same error but after 3-4 minutes, the web application finally got loaded on heroku. Most probably it's caused due to setting up of webpage on the heroku's server.

Kanishk Mair
  • 333
  • 1
  • 4
  • 8
  • There are many possible reasons you were seeing these 5XX errors, but most likely in this case you were either getting H81 (Blank app) or H14 (No web dynos running), both of which should result in HTTP 503 responses. The way to know for sure is to check the logs in either the app dashboard or by using e.g. `heroku logs -t`. A full list of detailed error code descriptions is available in the error codes help article: https://devcenter.heroku.com/articles/error-codes – Brandon DeRosier Jul 28 '19 at 08:42
2

Do you use database ? if yes, don't forget to add database add-ons in resource of your heroku project and create table that you need in database.

Fatur
  • 141
  • 9
  • 1
    Welcome to stack overflow. Consider posting this as a comment instead of an answer. After gaining certain number of reputation points you will be able to post comments to other questions/answer. – Rahul Bhobe Jul 31 '20 at 18:19
  • Thank you Rahul. Just like you said, i haven't enough reputation points to make a comments. – Fatur Feb 14 '21 at 18:32
1

I was facing the same issue with this. Locally the app works but when I pushed it to heroku I was getting an internal server error. Then I realized that the path was rather not known.

assume this is the url for the app on heroku, https://myapp.herokuapp.com

this url was the error, because the route did not exit not looked like any of the routes I had. My route start with or my base url was, myapp/

https://myapp.herokuapp.com/myapp/ worked for me.

I was running http://127.0.0.1:5000/myapp/ locally which should be the same as https://myapp.herokuapp.com/myapp/ on heroku

0

Check response redirect in your control and in file name view (html) , uppercase and lowercase characters very influential

0

I removed the .env file from my .gitignore file while pushing my code to Heroku. It is worked for me.

Ethan
  • 876
  • 8
  • 18
  • 34
0

If your application has a database (as it should) make sure to makemigrations and perform migrate. You can do this using Heroku CLI from your Heroku App dashboard.

To make migrations ==> python manage.py makemigrations

To migrate ==> python manage.py migrate

If the above suggestions do not fix the (500) problem, go to your environment variable and change its value to True. Then return to your application to read the error message. Your cue will definitely be there.

Cheers!

Drevid
  • 1
  • 1
0

I was stuck with the same problem. For me the problem was in my_project/wsgi.py . I had setup 3 settings file under my_project/my_project/settings folder and I had configured the necessary configuration under manage.py to detect the setting file but forgot the configuration under my_project/wsgi.py . So resolving this solved the problem for me.

Nirjal Mahat
  • 247
  • 3
  • 5
0

Add the APP_KEY from the terminal as:

heroku config:set APP_KEY=[App_key] -a project-name 

this worked for me.

Ethan
  • 876
  • 8
  • 18
  • 34
0

I know I'm late, but in my case it was also just adding the KEY that I was loading locally from .env to the heroku server as an environment variable.

You can simply do it like this:

heroku config:set SECRET_KEY_NAME="YOUR_SECRET_KEY_VALUE"

For example, it could be something like this:

heroku config:set API_KEY="probablysomestringofcharacters"
himalczyk
  • 13
  • 3
-1

I fixed my issue by removing .env file from my gitignore.

Kat Mieu
  • 9
  • 2
  • BE CAREFUL! Any projects' .env SHOULD be in gitignore; you want this for security reasons. Your environment variables (the contents of the .env file) should be protected and separate from your code. SOLUTION: You should manually input the env variables into your config settings in your Heroku dashboard. This is the normal and correct thing to do. – Kalnode Jul 02 '21 at 15:21