9
9
95506682020-07-22 11:47:10
Django
9550668, 2020-07-22 11:47:10

Django back-end + JSON + front-end. How to organize file exchange correctly?

Good afternoon everyone once again)

I want to ask for advice on the correct organization of file exchange. Namely: photo (front-end -> back-end processing and saving, back-end -> frond-end), video (front-end -> back-end compression and processing and saving, back-end -> front-end). Requests go through JSON (I use Postman).

1. How reasonable is it to store an object in the Django Model as a File/Image field? Can there store a link on the server to the file?
2. How to receive / transmit information in a more reasonable way? For example, JSONResponse gives a link to a file or the file itself (how big will the exchange of requests be because of this?).
3. And what is the best way to store files on the server? Explicitly store by reference, for example, https://xxx.xxx.xxx.xxx/blablabla/media/video/1.avi- not the most correct option)
4. Suppose there are 10,000 users, each with their own avatar. Are all avatars stored in just one folder on the server? And the same thing, for example with user photos, etc.

Maybe there are manuals that are clearly written? Video reviews or something else to complement your professional vision?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-07-22
@9550668

it's better to ask one question at a time
1. File / Image field stores it like that, with a link to the file
2. JSONResponse gives a link to the file, it’s possible to very small data: URL
3, 4 it’s okay to store it this way, only not in one folder, but automatically into multiple subfolders. It can also be stored in object storage, for example, S3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question