1👍
✅
See this relevant boto issue: https://github.com/boto/boto/issues/2868
Boto has some problems with string encodings in Python3. If you know the encoding, you Using response.content
instead of response.text
fixes the problem:
document_contents = ContentFile(response.content)
👤Zags
0👍
I had a similar problem.
I changed to boto3 and storage engine to to.
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
Finally I also had to convert the content to binary using .encode(‘utf-8’)
my_model.save("filename", document_contents.encode('uft-8'))
- Django / Python – Date joined check
- How to use simple-menu in django?
- Django model objects, admin and javascript files
- Building an API
- Django/Postgres: Choose from DISTINCT ON sets
Source:stackexchange.com