upated
This commit is contained in:
11
app.py
11
app.py
@@ -21,12 +21,7 @@ from datetime import datetime
|
||||
import pytz
|
||||
|
||||
from flask import Flask, jsonify, request, render_template
|
||||
|
||||
DB_PATH = os.environ.get("DB_PATH", "./speed_tests.sqlite3")
|
||||
PAGE_SIZE_DEFAULT = 200
|
||||
PAGE_SIZE_MAX = 1000
|
||||
SERIES_MAX_POINTS_DEFAULT = 5000
|
||||
SERIES_MAX_POINTS_HARD = 20000
|
||||
from config import SERIES_MAX_POINTS_DEFAULT, DB_PATH, SERIES_MAX_POINTS_HARD, PAGE_SIZE_MAX, PAGE_SIZE_DEFAULT
|
||||
|
||||
app = Flask(__name__, template_folder="templates")
|
||||
|
||||
@@ -60,7 +55,7 @@ def api_series():
|
||||
q_from = request.args.get("from", type=float)
|
||||
q_to = request.args.get("to", type=float)
|
||||
max_points = request.args.get("max_points", type=int) or SERIES_MAX_POINTS_DEFAULT
|
||||
max_points = max(100, min(max_points, SERIES_MAX_POINTS_HARD))
|
||||
max_points = max(1, min(max_points, SERIES_MAX_POINTS_HARD))
|
||||
|
||||
params = []
|
||||
where = []
|
||||
@@ -167,5 +162,5 @@ def index():
|
||||
|
||||
if __name__ == "__main__":
|
||||
port = int(os.environ.get("PORT", 5000))
|
||||
app.run(host="0.0.0.0", port=port, debug=True)
|
||||
app.run(host="0.0.0.0", port=port)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user