views:

30

answers:

2

Hi

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.

A: 

No, there isn't a tutorial on this. Django doesn't support it out of the box, and it's horribly inefficient. Don't do it.

Daniel Roseman
? So how do you create a image database in django? What would be the very efficient way to do that? How can you create a site where all your images would be shown. As a project to learn django?Your answer was not very helpful.
MacPython
A: 

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.

Chris Lawlor
Thank you very much for the help!
MacPython