Answer the question
In order to leave comments, you need to log in
How to scan folders and files in a directory and output the result to a Django template?
There is a folder with the following structure:
camera
2015-08-01
object
img1.jpg
img2.jpg
...
object
img1.jpg
img2.jpg
...
2015-08-02
object
img1.jpg
img2.jpg
...
object
....
Answer the question
In order to leave comments, you need to log in
If you do it right as you described, then terrible crutches will come out, because the web server should give the pictures, and you can’t output them directly from some folder to the template. It seems to me better to write a custom management command to import these objects into the database, and then display them with a regular ListView. By cron, for example, or in some other way, run this command again for import. It seems to me that to implement such functionality, it will be necessary to write 20-30 lines of code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question