Skip to content

Commit f3cd720

Browse files
committed
Fix 2
1 parent 95c4ca2 commit f3cd720

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

backend/api/app.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from flask import Flask, request, jsonify, send_from_directory
1+
from flask import Flask, request, jsonify, send_from_directory, send_file
22
from pymongo import MongoClient
33
from datetime import datetime, timedelta
44
import threading
@@ -86,6 +86,13 @@ def deprecated_get():
8686
"message": "Please use /fast_statistics instead"
8787
}), 410
8888

89+
@app.route('/fast_statistics', methods=['GET'])
90+
def fast_statistics():
91+
try:
92+
return send_file(JSON_FILE, mimetype='application/json')
93+
except Exception as e:
94+
return jsonify({"error": "Could not load statistics", "details": str(e)}), 500
95+
8996
@app.route('/stats<int:num>.png')
9097
def get_stat_image(num):
9198
try:

backend/nginx/nginx.conf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ http {
3535
add_header 'Access-Control-Allow-Headers' 'Content-Type' always;
3636

3737

38-
# statistics
39-
location = /fast_statistics {
40-
alias /var/www/stats/fast_statistics;
41-
add_header Cache-Control "no-cache, must-revalidate";
42-
}
43-
4438
location ~ ^/stats\d+\.png$ {
4539
alias /var/www/stats/;
4640
try_files $uri =404;

0 commit comments

Comments
 (0)