Fixed, or at least worked around.
I had
MEDIA_URL = http://localhost/media/
in settings, which triggered this clause in the thumbnail template tag:
if "://" in settings.MEDIA_URL:
with open(thumb_path, "r") as f:
default_storage.save(thumb_url, File(f))
Not sure exactly why this fails, but there is an open file object (also
called f) at this point, and the given code is trying to save to the same
path represented by that object. (This is Ubuntu 12.04).
Anyway, changing to
MEDIA_URL = '/media/'
fixes the issue.
On Friday, January 31, 2014 6:06:13 PM UTC, Josh Cartmell wrote:
>
> Even though easy_thumbnail is working, I would still guess this has
> something to do with PIL. Try to pip install pillow on the live
> environment and make sure that when it is finishing installing it says that
> it has jpeg support.
>
> Hopefully you can get this worked out.
>
>
> On Fri, Jan 31, 2014 at 6:20 AM, gmflanagan <[email protected]<javascript:>
> > wrote:
>
>> Hi
>>
>> Can't figure this out. It doesn't appear when working with the devserver
>> and has only appeared when doing a local test deploy of a cartridge shop -
>> so a nginx/gunicorn/django setup on the same box that I'm developing on.
>>
>> The issue is - no thumbnail is generated in the admin when a product
>> image is uploaded.
>>
>> And this is a problem because, in the admin interface, a large image will
>> swamp the product and product list tables (given a small laptop screen) and
>> require horizontal-scroll to navigate.
>>
>> It looks like the "thumbnail" template tag
>> (mezzanine.core.templatetags.mezzanine_tags) is failing somehow, but
>> catching the Exception and falling back to just returning the original
>> image.
>>
>> A file is actually created in the thumbnails directory, but it has zero
>> bytes and has an indexed suffix, so
>>
>> <MEDIA_ROOT>/product/IMG-123.JPG
>>
>> becomes
>>
>> <MEDIA_ROOT>/product/.thumbnails/IMG-123-48x48_1.JPG
>>
>> Then it seems, each page view triggers another attempt to generate the
>> thumbnail and you get:
>>
>> <MEDIA_ROOT>/product/.thumbnails/IMG-123-48x48_2.JPG
>> <MEDIA_ROOT>/product/.thumbnails/IMG-123-48x48_3.JPG
>>
>> etc.
>>
>> All zero byte files.
>>
>> All the files created have the correct file ownership and permissions.
>>
>> Also, in other parts of the site, I am using "easy_thumbnails" to
>> generate thumbnails and there is no problem with that. So I'm not sure what
>> is happening, since as far as I can see, both libraries are using PIL to do
>> the image generation.
>>
>> It's probably something with my setup, since it works with local
>> development, but it's still baffling me.
>>
>> I'm on the point of replacing the Mezzanine admin ImageWidget with the
>> equivalent using easy_thumbnail, unless anyone has any ideas?
>>
>> jerd
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.