Hi 
I got the same issue, have u fix that problem?

BTW the solution link is broken
https://stackoverflow.com/questions/50063390/s3-image-thumbnail-cache-url-goes-bad-after-one-pageview-django-oscar
 

On Friday, April 27, 2018 at 11:48:19 PM UTC+10, King Olami wrote:
>
> solution on 
> https://stackoverflow.com/questions/50063390/s3-image-thumbnail-cache-url-goes-bad-after-one-pageview-django-oscar
>
> On Friday, April 27, 2018 at 1:44:34 PM UTC+1, King Olami wrote:
>>
>>
>>
>> For some reason yet unknown to me, a product's thumbnails disappear from 
>> view after just a single load of a page (both in Dashboard and Product 
>> Detail view) because the template seems to be truncating the URLs. This 
>> problem doesn't happen to statics at all.
>>
>> To replicate:
>>
>> 1. Upload an image for a product using the dashboard. The image gets 
>> stored in the correct S3 bucket, media path,is accessible by all, and so 
>> on. (confirmed with django admin, AWS Console and sorl debug logging)
>>
>> 2. System returns the correct working URL 
>> https://s3.amazonaws.com/mybucket/*media*/cache/XXX/YYY/ZZZ.jpg that 
>> works on first page view request.
>>
>> 3. Reload the page. System returns broken URL 
>> https://s3.amazonaws.com/mybucket/cache/XXX/YYY/ZZZ.jpg (missing 'media' 
>> path)
>>
>> 4. Running python manage.py thumbnail cleanup, python manage.py thumbnail 
>> clear, restart gunicorn takes up back to step 2
>>
>>
>> Am I missing something? Should I be looking at sorl.thumbnail or oscar 
>> templates?
>>
>>
>>
>>
>> Some relevant settings and data:
>>
>> *Snippet from pip requirements*
>> sorl-thumbnail==12.3
>> boto==2.38.0
>> django-storages==1.1.8
>> awscli==1.7.39
>>
>> *Snippet from settings.py*
>> THUMBNAIL_DEBUG = True
>> THUMBNAIL_PRESERVE_FORMAT=True
>> OSCAR_IMAGE_FOLDER = 'images/products/'
>>
>> AWS_STORAGE_BUCKET_NAME = 'mybucket'     
>> AWS_ACCESS_KEY_ID = 'mykey'
>> AWS_SECRET_ACCESS_KEY = 'mysecret'
>> AWS_S3_CUSTOM_DOMAIN = 's3.amazonaws.com/%s' % AWS_STORAGE_BUCKET_NAME
>>
>> STATICFILES_LOCATION = 'static'
>> MEDIAFILES_LOCATION = 'media'
>> DEFAULT_FILE_STORAGE = 'utils.MediaRootS3BotoStorage'
>> STATICFILES_STORAGE = 'utils.StaticRootS3BotoStorage'
>> STATIC_ROOT = location('static')
>> MEDIA_ROOT = location('media')
>> STATIC_URL = "https://%s/%s/"; % (AWS_S3_CUSTOM_DOMAIN, 
>> STATICFILES_LOCATION)
>> MEDIA_URL = "https://%s/%s/"; % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
>>
>> *Entire utils.py*
>> from storages.backends.s3boto import S3BotoStorage
>>
>> StaticRootS3BotoStorage = lambda: S3BotoStorage(location='static')
>> MediaRootS3BotoStorage  = lambda: S3BotoStorage(location='media')
>>
>> *Entire thumbnail_kvstore db*
>>                              key                              
>> |                                                                 value
>>
>> --------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------
>>  sorl-thumbnail||image||e14a50914a152da773157a34d30d4ab4      | 
>> {"storage": "storages.backends.s3boto.S3BotoStorage", "name": 
>> "images/products/ZZZ.jpg", "size": [2000, 3000]}
>>  sorl-thumbnail||image||5cab03b2ed5b48fccd2309abdddd8d7e      | 
>> {"storage": "storages.backends.s3boto.S3BotoStorage", "name": 
>> "cache/ee/25/ee25c9c57c544b0eadaa892c6bd1ce84.jpg", "size": [267, 400]}
>>  sorl-thumbnail||thumbnails||e14a50914a152da773157a34d30d4ab4 | 
>> ["5cab03b2ed5b48fccd2309abdddd8d7e"]
>>  sorl-thumbnail||image||8a767e549b0b784968c1e5aca445532a      | 
>> {"storage": "storages.backends.s3boto.S3BotoStorage", "name": 
>> "cache/60/84/608471a1fac28fb8b5c885e95d3d8797.jpg", "size": [103, 155]}
>>
>>
>> This question was asked before but has not received an answer 
>>
>

-- 
https://github.com/django-oscar/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
--- 
You received this message because you are subscribed to the Google Groups 
"django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-oscar+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-oscar.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/django-oscar/ae271403-9587-47c5-b446-0a09428c0024%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to