I\'m trying to deploy a Django app to Heroku, it starts to build, download and installs everything, but that\'s what I get when it comes to collecting static files
DO NOT disable collectstatic
on heroku with heroku config:set DISABLE_COLLECTSTATIC=1
. This will just hide the error and not make your app healthy.
Instead, it's better to understand why the collectstatic command fails because it means something is not right with your settings.
Run locally both commands:
python manage.py collectstatic
python manage.py test
You should see one or more error messages. Most of the time, it's a missing variable (for ex: STATIC_ROOT
) you must add to your project settings.py
file.
It's necessary to add the test
command because some collectstatic
related issues will only surface with test
, such as this one
Once you've fixed all the error messages locally, push again to heroku.
Remember you can also run commands directly in your heroku VM. If you cannot reproduce locally, run the collecstatic command in heroku and check what's going on directly in your production environment:
python manage.py collectstatic --dry-run --noinput
(Same goes for heroku console obviously)