Download link for export

This commit is contained in:
Simon 2018-06-06 11:27:23 -04:00
parent 7ac7972fd6
commit 820caa171b
2 changed files with 10 additions and 2 deletions

10
app.py
View File

@ -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/<int:website_id>/")
def website_info(website_id):

View File

@ -23,7 +23,7 @@
<tbody>
{% if export_file_stats %}
<tr>
<td>out.csv.xz</td>
<td><a href="/get_export">out.csv.xz</a></td>
<td>{{ export_file_stats.st_size }}</td>
<td>{{ export_file_stats.st_mtime|datetime_format }}</td>
</tr>