Remove old temporary files when user is logged out
问题 I have a view that takes logged in user input then runs a function to produce a report. The result is returned in an HTML page. I render the report to PDF as well. I create a PDF with the content from my function and save it in some folder on the server. I don't want to have my server filled with files from every run, so I create a temporary folder (in tmpfs) for each user when they log in and save the path in their session, which is not permanent. session['temp_path'] = '/dev/shm/<random