0

I know this issue has been discussed a thousand times here, but I couldn't stop putting it again as I'd a difficult time finding the cause of this problem and a working solution.So, my problem is when I set DEBUG=True on heroku, everything works, and if it is set to False, it gives server error(500). Please help me!

Things I've tried and didn't work:

  1. run collectstatic locally and then tried to add, commit and push to Heroku, but didn't work.
  2. done ALLOWED_HOSTS = ["herokuapp.com"]
  3. Anyhow when nothing worked, switched the database from sqlite to postgres and it is working fine.But somehow, the error still persists!

My wsgi.py file looks like this:

import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings")
application = get_wsgi_application()

The heroku logs I see:

2019-01-05T17:41:17.844144+00:00 app[web.1]: [2019-01-05 17:41:17 +0000] [10] [INFO] Booting worker with pid: 10

2019-01-05T17:41:17.857502+00:00 app[web.1]: [2019-01-05 17:41:17 +0000] [11] [INFO] Booting worker with pid: 11

2019-01-05T17:41:18.234497+00:00 app[web.1]: base dir path /app

2019-01-05T17:41:18.240629+00:00 app[web.1]: local settings failed

2019-01-05T17:41:18.357015+00:00 app[web.1]: base dir path /app

2019-01-05T17:41:18.358185+00:00 app[web.1]: local settings failed

2019-01-05T17:41:19.010564+00:00 heroku[web.1]: State changed from starting to up

2019-01-05T17:41:21.230071+00:00 app[web.1]: 10.28.83.116 - - [05/Jan/2019:17:41:21 +0000] "GET / HTTP/1.1" 500 27 "https://dashboard.heroku.com/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0"

2019-01-05T17:41:21.230836+00:00 heroku[router]: at=info method=GET path="/" host=obscure-dusk-29347.herokuapp.com request_id=b5fb4554-fa37-4e39-b710-fae1ac8c6651 fwd="103.208.75.78" dyno=web.1 connect=1ms service=184ms status=500 bytes=234 protocol=https

2019-01-05T17:41:21.670528+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=obscure-dusk-29347.herokuapp.com request_id=0d271d43-17a0-4b37-aff1-51767d192d35 fwd="103.208.75.78" dyno=web.1 connect=1ms service=20ms status=404 bytes=266 protocol=https
J. Ghyllebert
  • 2,009
  • 1
  • 29
  • 35
user10058776
  • 183
  • 1
  • 3
  • 17

1 Answers1

0

I did it, finally!

The DEBUG variable in my settings.py was like DEBUG = config('DEBUG', default=False, cast=bool) . So I just changed it to be DEBUG = config('DEBUG') and it worked.

user10058776
  • 183
  • 1
  • 3
  • 17