When we run $ python manage.py runserver --settings=project.settings.local
there are 4 different possible combinations:
The solution for me was to run python manage.py collectstatic
.
If you run $ heroku logs --tail
inside terminal before doing this, the log will tell you what static files cannot be found (404).
I have had the same issue. But then I removed this row in settings.py
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
Now I dont have 500 error when DEBUG=False. But probably, I guess gzip functionality doesnt work anymore.
something here helped me:
I had a static css file link (and honestly, it had just a few lines), once I removed the link, and inserted into a tag in my main.html, it worked just fine: with DEBUG=False
:D
Configuring the server e-mail and seeing the stack trace as mentioned by Two-Bit Alchemist was the key. We added these lines to our settings:
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '***'
EMAIL_HOST_PASSWORD = '***'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
SERVER_EMAIL = EMAIL_HOST_USER
And received an e-mail with this error in the stack trace:
ValueError: The file 'stylesheets/application.css' could not be found with <whitenoise.django.GzipManifestStaticFilesStorage object at 0x7fdcebb94550>.
We'd had problems with static files before but though we'd fixed them. The css file it's complaining about not being able to find doesn't exist anymore and isn't referenced anywhere so I'm not sure why this error is even coming up, but we fixed it by adding an empty application.css
file.
What you should be doing here is this:
$ heroku logs --tail
in one terminal window.$ heroku ps:restart
to restart your dynos.Watch the logs, and see the actual traceback. This will tell you exactly what's going on. Based on your configuration it could be a number of issues.
I hope this helps someone someday.
I had this similar problems and it took a while before i fixed it.
Check your <a></a>
tags. If an href
attributes points to a template/link that don't exist.
You might encounter such.