I am using django-compresor for an app deployed on heroku with amazon S3 serving static files. Everything is working fine except that images in my css referenced in the background-image: url() are not rendered with with the correct path.
My static files are organized in the following directory structure:
-static
-myapp
-js
-css
-img
-bootstrap
-js
-css
-img
-othervendor
-js
-css
-img
Therefore, the path i am using in the url() is relative to the css file:
url("../img/icon.png")
All of my css files are compressed and moved to the CACHE folder in my static directory and the url to the CACHE directory is rendered correctly as:
https://mybucket.s3.amazonaws.com/static/CACHE/css/somehash.css
The problem is that the images in the css files url() are rendered as:
https://mybucket.s3.amazonaws.com/static/CACHE/img/imagefile.png
and it should be:
https://mybucket.s3.amazonaws.com/static/myapp/img/imagefile.png
or if the images were copied to the CACHE directory this would work:
https://mybucket.s3.amazonaws.com/static/CACHE/img/imagefile.png
My temporary fix is to change the paths of images in my css to the following and it works:
url("/static/foldername/img/icon.png")
I am new to django & compressor so i'm not sure what the correct behavior is supposed to be, but this does not seem to be correct. The way i see it, the problem can be fixed if i can get django compressor to do one of two things: 1)copy all images referenced in css url() to the CASHE/img directory OR 2)render the correct url represented by ../ Here is my setup:
The css files in my template are in a {% compress css %} block.
s3utils.py (used to make separate med