M
M
Maxim Alyukov2020-06-29 10:58:31
Django
Maxim Alyukov, 2020-06-29 10:58:31

What is the difference between static and media files?

Hey! Can you please explain how to understand the differences between static and media files?

I asked this question when I started to argue that static files, as a rule, do not change. For example css files. And media files are often pictures. But here's the salt. If there are pictures that are, for example, a background, are they static files? Is it correct to store them in a directory with statics?

How to find this edge?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2020-06-29
@mvxmvl

Maxim Alyukov statics is everything that goes along with the project. That is, css, js, images that relate to the design of the site, pins and everything you need to start a project from scratch.
Media is the same files (not necessarily images) that appear during the operation of your site. For example, the user's avatar is media, as it appeared during the operation of the site. Cache is also media, for example, sorl thumbnail creates a cache in media/cache
. Also, static must be sent to the git repository, but media is not sent to the repository.

D
DoomAndGloom, 2022-02-02
@DoomAndGloom

You are right. The static is the code. Media is data.
If a picture is a background, then it is part of the code, part of the delivery from the programmer to the customer. That is, then it is static.
If the picture is a user avatar uploaded by a user of your site, then it is media, because this is user data, not part of the code. The site from the programmer to the customer can be delivered without media, and the customer himself/with the help of managers/users will fill in all the media as he needs.
Article on this topic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question