How to run code after Flask send_file() or send_from_directory()

前端 未结 1 1076
别跟我提以往
别跟我提以往 2021-02-20 01:01

I have a Flask-based website where users can download some PDF files.

This is straightforward to implement using Flask\'s send_file() and send_from_directory().

<
相关标签:
1条回答
  • 2021-02-20 01:40

    You can't. While send_file streams the file using Flask when using the dev server, it may (and really should for performance) use the web server (nginx, apache, etc.) and X-SendFile in production. Since the web server is beyond the control of the application, you're out of luck.

    0 讨论(0)
提交回复
热议问题