Sorl-Thumbnail returns error: "SuspiciousOperation: Attempted access to '/media/products/505.jpg' denied"06 Feb · by Tim Kamanin · 1 min read
When Solr Thumbnail (https://github.com/mariocesar/sorl-thumbnail) returns and error like "SuspiciousOperation: Attempted access to '/media/products/505.jpg' denied" or Bad request: 400 you need to check the path of the image you want to resize: it shouldn't start with your MEDIA_ROOT like * '/media/products/505.jpg'. If you look into the database, you'll see that the path may be saved here as *'/media/products/505.jpg' *where *' /media/' is MEDIA_ROOT. It shouldn't be like that, the path should be saved as ' products/505.jpg' instead which is a correct way to save image/file path into the database. Some modules like django-ajaximage have such a problem. Be aware of that.