From cdfce4ab022fa3800dbcf61e585d3f0761d89ab9 Mon Sep 17 00:00:00 2001 From: shouchih_chen Date: Fri, 27 Jun 2025 14:24:33 +0800 Subject: [PATCH] add sample.csv download --- app.py | 4 ++++ templates/index.html | 3 +++ 2 files changed, 7 insertions(+) diff --git a/app.py b/app.py index e82314c..dac8883 100644 --- a/app.py +++ b/app.py @@ -93,6 +93,10 @@ def upload_csv(): return "File uploaded successfully", 200 +@app.route('/download_sample_csv') +def download_sample_csv(): + return send_file('resource/sample.csv', as_attachment=True) + if __name__ == '__main__': # 當在生產環境部署時,不建議使用 debug=True # 可以指定 host='0.0.0.0' 讓外部可訪問 (在防火牆允許的情況下) diff --git a/templates/index.html b/templates/index.html index 9901aa7..1cbe119 100644 --- a/templates/index.html +++ b/templates/index.html @@ -15,6 +15,9 @@ +
+ 下載範例 CSV 檔 +