Media Serving and File Uploads
Media files refer to extra files that can be added after deployment to enrich your Django application. Usually, they are extra images that you would use in your site, but any type of file (including video, audio, PDF, text, documents, or even HTML) can be served as media.
You can think of them as somewhere between dynamic data and static assets. They aren’t dynamic data that Django generates on the fly, such as when rendering a template. They also aren’t the static files that are included by the site developer when the site is deployed. Instead, they are extra files that can be uploaded by users or generated by your application for later retrieval.
Some common examples of media files (that you’ll see in Activity 8.01 – image and PDF upload of books, later in this chapter) are book covers and preview PDFs that can be attached to a Book
object. You can also use media files to allow users to upload images for a blog post...