使用 Flask 生成和下载 .docx 文件的文件夹

Generating and downloading folder of .docx files with Flask

我目前正在学习如何使用 Flask,我的目标是让用户提供某些输入,单击生成,然后下载由不同 python 生成的 .docx 文件的 .zip 文件脚本。

目前,我的 .docx 生成 python 脚本将文件夹保存在本地,我认为这并不理想。它被保存为 .docx 文件的文件夹,那么让输入生成这些文件的变量的用户能够下载这些文件的最佳方法是什么?

zipfile module and flask.send_from_directory就是你所需要的