diff --git a/app.py b/app.py index 5c16cff..28780d5 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template, redirect, request, flash, abort, Response +from flask import Flask, render_template, redirect, request, flash, abort, Response, send_from_directory import os import json import time @@ -41,6 +41,14 @@ def downloads(): return render_template("downloads.html", export_file_stats=export_file_stats) +@app.route("/get_export") +def get_export(): + + if os.path.exists("static/out.csv.xz"): + return send_from_directory("static", "out.csv.xz", as_attachment=True, mimetype="application/x-xz") + return abort(404) + + @app.route("/website//") def website_info(website_id): diff --git a/templates/downloads.html b/templates/downloads.html index 397e6e6..31c6d09 100644 --- a/templates/downloads.html +++ b/templates/downloads.html @@ -23,7 +23,7 @@ {% if export_file_stats %} - out.csv.xz + out.csv.xz {{ export_file_stats.st_size }} {{ export_file_stats.st_mtime|datetime_format }}