3👍
I solved it by changing the last line of the save_entry function to
default_storage.save(filename, ContentFile(content.encode('ascii')))
per this answer https://stackoverflow.com/a/4053205
0👍
I’ve got the same issue and here is my solution:
ContentFile uses StringIO if you provide content as a string or BytesIO if you provide content as ByteArray. I guessed it could be issue of StringIO class so I simply converted my content to byte array and passed fixed argument so ContentFile class initialized BytesIO as stream_class:
byte_list = []
a_byte_array = bytearray(content,"utf-8")
for byte in a_byte_array:
binary = bin(byte)
byte_list.append(binary)
save(query, a_byte_array)
- [Django]-JQuery not found: Uncaught ReferenceError: $ is not defined
- [Django]-Deploying Django with gunicorn No module named ImportError: No module named validation
- [Django]-Model Manager in Django – No reference to model class?
- [Django]-Benefit of using logging over print() to log information to Papertrail in a Django Heroku app
- [Django]-Django query executed in view returns old data
Source:stackexchange.com