A
A
Alexander2018-12-24 18:31:43
Django
Alexander, 2018-12-24 18:31:43

What is the best way to implement private media files?

simple model:

class File(BaseModel):
    name = models.CharField(max_length=255, null=True)
    content_type = models.CharField(max_length=255, null=True)
    file = models.FileField()

Any user can access media files: mysite.com/media/file/asdasdsadsad.jpg .
It is necessary to make sure that users have permission to view certain files.
What can you advise how to implement it? As I understand it, nginx will issue only "public files", and already at the django level, make the issue of "private files".

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question