Django-oscar: Please copy/symlink the 'missing image' image

Created on 29 Apr 2014  路  7Comments  路  Source: django-oscar/django-oscar

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?

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):

OSCAR_MISSING_IMAGE_URL = MEDIA_URL + 'image_not_found.jpg'

All 7 comments

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 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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rollcat picture rollcat  路  3Comments

eve1234 picture eve1234  路  5Comments

codeinthehole picture codeinthehole  路  4Comments

prince-tanapong picture prince-tanapong  路  6Comments

ZamorakLin picture ZamorakLin  路  4Comments