well, we could see the use case to see the correct approach but, what comes to mind is using try/except/finally
On Nov 14, 2017 17:56, "Ruifeng Hu" <huruifeng...@gmail.com> wrote: > Hi All, > > I am now writing a web service which can generate a file and download it > automatically for users, but I want to delete it after the file has been > downloaded(after return the HttpResponse). What should I do ? > > Thank You! > > Ruifeng Hu > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-users/508fcace-efc8-42c0-a667-b760fec4c141%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/508fcace-efc8-42c0-a667-b760fec4c141%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Bx7b_HHguaxu9di0xcJadKpJv%3D1eJZKFuHELzt5RR%3D6n5jvLw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.