I am getting an error when DEBUG
is set to False
or unset
in Heroku, in Django app, when I activate logs.
ValueError: Missing staticfiles manifest entry for 'css/sass/home.css'
Seems that my SCSS files are not compiled when I deploy on Heroku, while it compiles automatically locally with django-sass-processor
It seems that heroku skipps the compiling scss files part, and pass directly to collecting statics so:
1st step was to disable collecting static files:
heroku config:set DISABLE_COLLECTSTATIC=1
2nd step is to run a post-compile process:
heroku run python manage.py compressscss
and then
heroku run python manage.py collectstatic --noinput
This can be run automatically by overriding the post-compile of python build pack shown here in this post Link to a how to create postcompile file
Where you create a file in bin/post_compile
in the root of the app with:
#!/usr/bin/env bash
cd "$1" || exit 1
python manage.py compilescss --traceback
python manage.py collectstatic --noinput --traceback
And push to Heroku to apply changes.