Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django form wizard: Delete temporary files stored by intermediate steps

I am using django(1.4) formwizard for my application. In step 1 I am uploading 2 files. These files are used in second step. Everything is working fine but this ---> "When I complete all steps OR I stop after step 1 I still have temporary files stored in MEDIA directory"

How can I ensure that these files are deleted in any of the cases?

like image 389
Aryaveer Avatar asked Jul 26 '13 13:07

Aryaveer


1 Answers

Django says on the documentation that you have to manage these files yourself, so:

You can set the uploading path to /tmp (if you are using Linux), so that they are automatically deleted.

Another approach is that you can write a script to run periodically and delete them.

like image 84
Nikign Avatar answered Nov 18 '22 23:11

Nikign