FLASK 框架如何生成HTML静态页面
## 如何获取当前项目根目录,如何获取当前文件所在目录
from flask import current_app @index_bp.route('/') def index(): project_dir = current_app.root_path print("项目目录为", project_dir) filename = os.path.join(current_app.root_path, 'my_folder', 'my_file.txt') print("#####", filename) current_dir = os.path.dirname(os.path.abspath(__file__)) print("当前文件所在目录为:", current_dir)