N
N
not-a-programmer2021-07-23 10:37:56
Django
not-a-programmer, 2021-07-23 10:37:56

Is it possible to display media files from arbitrary directories on a PC using Django in the browser?

Good day everyone! As an independent study of Django/Python, I'm thinking of a small test project: something like a home local "movie search" - a movie database with the ability to view movies from a local disk. Access will only be on the machine running the Django webserver, the movie video files will be on the same machine.

The question is: is it possible in principle to display video files on web pages issued by Django if they are not in the /static directory of the project, but in different directories on the PC, and at the same time it is undesirable to move them to the project directory? Reading the settings.py documentation only raised more questions and doubts that this could even be done. The problem I see is that if you just specify in the tagvideo is a link to a local file, the browser will not download anything from the disk for security reasons and the browser needs to give something through the web server. How I imagine how everything should look like:

Directories on the computer:

D:\Films # Здесь лежат видеофайлы
C:\Torrents # Здесь тоже фильмы
C:\MyProject # А здесь проект на Django и БД


Let's say we have a module to which we pass the paths to the above video directories, and it scans them for video files and writes the paths to them in the database, and then Django takes these paths from the database when generating the page and inserts them into the page.

The question can be answered in one word: it is possible / not possible to implement this, and then I will go to read, read and read again.

Thanks in advance for your reply!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stefan, 2021-07-23
@not-a-programmer

It is possible to implement this, read about Nginx, and write paths for movies

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question