Search code examples
databasedjangoimagestore

Django Db Images video


How can I store Images, Videos and Audio via Django in a Mysql db?

I know I can either store the link to the image, video, audio, or the image, video, audio itself.

But how does this exactly work.

I know about the models and how they create tables via the manage.py. But is there a good tutorial on how to create an image (e.g. jpg, tiff etc) database via Django.

Thanks

L.


Solution

  • Daniel is referring to the fact that storing large binary files in a DB is not efficient. Use the filesystem instead - take a look at FileField and ImageFileField, which are designed to handle file uploads:

    http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield

    The only thing stored in the DB is the path to the binary file.