when I try to deploy an Oscar-based site to Heroku, I get this error:
Please copy/symlink the 'missing image' image at /app/slstore/slstore/public/media/image_not_found.jpg into your MEDIA_ROOT at /app/slstore/slstore/public/media. This exception was raised because Oscar was unable to symlink it for you.
I would think that running the collectstatic command would create the public and media dirs and put this file in the media dir. Is that not the case?
The "image not found" image is tricky case. Sorl (the thumbnailing engine) requires the source image to be under MEDIA_ROOT which means it's not a static file that collectstatic would pick up. Hence Oscar tries to symlink it into your MEDIA_ROOT folder but issues that error message when it is unable to.
It's quite an ugly process that I'd like to remove but I've not seen a better way yet.
Closing issue for now as I don't think there's anything to do.
Is the solution then to make a directory public/media and copy the image_not_found.jpg into that dir? Where is the code that tries to symlink it?
What you suggest sounds right. Here's the part of Oscar that tries to create the symlink:
https://github.com/tangentlabs/django-oscar/blob/master/oscar/apps/catalogue/abstract_models.py#L1061
I've updated the docs in https://github.com/tangentlabs/django-oscar/commit/ebe1632d4c5f20b0933637b4bc84fc78b78e14e6
I just had this same problem with S3 (using Oscar 0.7) and was able to resolve it by placing the following in my settings.py (having properly set my MEDIA_URL for S3 and manually uploaded the missing image placeholder there):
OSCAR_MISSING_IMAGE_URL = MEDIA_URL + 'image_not_found.jpg'
I confirm @rayrrr 's solution works with S3 on Oscar 1.1. Thanks!
@rayrrr Thanks!
Most helpful comment
I just had this same problem with S3 (using Oscar 0.7) and was able to resolve it by placing the following in my settings.py (having properly set my MEDIA_URL for S3 and manually uploaded the missing image placeholder there):