fix: add eventlet monkey_patch and favicon route

This commit is contained in:
2026-03-12 13:21:53 +08:00
parent a38f5de32a
commit 106aafe2a9

View File

@@ -2,12 +2,15 @@
TCKRTUIYO - Rainfall Station RTU Web Interface
Flask Backend with SocketIO for Real-Time Updates
"""
import eventlet
eventlet.monkey_patch()
import os
import json
import time
import threading
from datetime import datetime
from flask import Flask, render_template, jsonify, request
from flask import Flask, render_template, jsonify, request, send_from_directory
from flask_socketio import SocketIO, emit
# Configuration
@@ -18,6 +21,11 @@ app.config['JSON_SORT_KEYS'] = False
# SocketIO with eventlet for production performance
socketio = SocketIO(app, cors_allowed_origins="*", async_mode='eventlet')
# Favicon route
@app.route('/favicon.ico')
def favicon():
return send_from_directory(os.path.join(os.path.dirname(__file__), 'static'), 'logo/[LOGO] TCK.svg', mimetype='image/svg+xml')
# Data paths
DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
SETTINGS_FILE = os.path.join(DATA_DIR, 'settings.json')