How to return 60, 000 file information in a folder by page by python webserver

  1. lists the files in the folder using the scandir library, but when there are more than 60, 000 files, the browser crashes
  2. try yield, but return the first 10 messages on the next request

do you have a good solution? ask for advice

Mar.21,2021

one suggestion is to store the file information of the folder in the database in advance, and then monitor the changes of the folder to modify the database in real time. It is really not appropriate to query the system call


cache queue

at every request.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bffc6a-32491.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bffc6a-32491.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?