How to store image files in Django?
django
Solution
A typical, real-world example would be to store uploaded images in a subdirectory of your site's `media/` directory :)
This can become a problem if you need to store more images than your app server has hard disk space, or you need more than one app server, or you want to use a CDN to decrease your latency, or… one of a thousand other things.
But, unless you've got specific up-front requirements, the only way to know which (if any) of those thousand things you'll need to worry about is to get your site launched, and the fastest way to do that is to store images in a subdirectory of `media/`.
If you do this using a `FileField`, and you're careful in your code not to assume, for example, that the image is a file on your local disk (for example, you do use the `.url()` method of `FileFile` and you don't use the `.path` property), it will be straight forward to move those images onto a more appropriate backend when (and if) the time comes.
Problem
What is the typical scenario of storing image files in Django? More specifically, are images stored directly in a database blob (e.g. MongoDB GridFS), on a local filesystem or Amazon S3? For all three cases are there tools or django packages available to simplify your life with storing images? I am currently saving images to and serving from the media folder in the Django project on a local development server. Someone told me it's a bad practice to serve static files on the same machine. So what's a typical real-world scenario of storing and serving static images in Django?