I have a Flask (It's not actually Flask, it's Quart, an asynchronous version of Flask with the same syntax and features) application that serves static files that are created temporarily by a command line tool. I want to delete the files after they have been served. I can do this with a normal route (not static) like so (pseudo-code, not tested):
@after_this_request
def delete_file():
path = "C:\Windows\System32\explorer.exe"
os.remove(path)
My question is, how do I achieve the same thing with a static file?