Forums

Django + Mysql Blob field

I use python 3.4.2 + django 1.8 + Mysql database. + Table persons with blob fields in which a photo of a person My question is how can I retrieving and saving a photo with django into Mysql Blob field.

Hey, andrejonker. In Django >= 1.6 you can use BinaryField for this purpose.

However, consider using media files and FileField instead of BLOBs. It'll probably be a better and easier solution for you.

Thanks for the answer. Problem is it a existing Mysql Persons Table with more than 1500 records and 1500 pictures of persons. So I cannot change the Blod field to something else unfortunately

Sounds doable, but you should probably ask this question on StackOverflow or some Django support group.