I am currently learning web development and I wonder what is the best and most flexible approach to storing media files? You never know how much will your website grow and because of that, I want to know how to handle big amounts of media files correctly using Django running on a Nginx server. I tried some googling, but media files handling in production is not that well documented, at least not as well as handling media files in development. Every suggestion will help me.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Really depends on how much searching and organizing you’ll need.
I personally prefer the idea of using a file-key in whatever DB I’m using that way I can experiment with different storage methods while the actual DB lookup keeps my static value. You’ll have to code something to load the actual media from the key, but you won’t have to worry about the two being tied together permanently.
Example: (I personally use mongo for my DB so everything is a JSON)
{ "_id":201,
"title":"kitten fights lemon",
"author":"CowFu",
"status":"Published",
"tags":["kitten","lemon","fight"],
"thumb":"p1000321",
"media":{"type":"mov","key":"m874389"}
}
That way I can just lookup the media.type and media.Key against whatever storage I’m using.
I’m currently loading from Ext4 on debian, but am going to try BtrFS next to see if there is any difference.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.