diff --git a/app.py b/app.py index 439f39c..ea48535 100644 --- a/app.py +++ b/app.py @@ -17,7 +17,7 @@ app = Flask(__name__) app.config['SECRET_KEY'] = config.FLASK_CONFIG['secret_key'] app.config['SEND_FILE_MAX_AGE_DEFAULT'] = config.FLASK_CONFIG.get('static_cache_timeout', 60) # Bez Eventlet (deprecated) – prosty tryb wątkowy. -socketio = SocketIO(app, cors_allowed_origins="*", logger=False) +socketio = SocketIO(app, cors_allowed_origins="*", async_mode="threading", logger=False) def get_file_hash(filename): full_path = os.path.join(app.static_folder, filename) @@ -317,7 +317,7 @@ def background_voltage_update(): except Exception as e: print(f"Worker Error: {e}") - time.sleep(config.CHART_CONFIG['update_interval'] / 1000.0) + #time.sleep(config.CHART_CONFIG['update_interval'] / 1000.0) if __name__ == '__main__': print("\n" + "="*50) @@ -325,4 +325,9 @@ if __name__ == '__main__': print("="*50 + "\n") socketio.start_background_task(background_voltage_update) - socketio.run(app, host='0.0.0.0', port=config.FLASK_CONFIG['port']) \ No newline at end of file + socketio.run( + app, + host="0.0.0.0", + port=config.FLASK_CONFIG["port"], + allow_unsafe_werkzeug=True + ) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index a9985b5..6fee4fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,4 @@ influxdb #influxdb-client simple-websocket python-socketio -flask-socketio -gevent -gevent-websocket \ No newline at end of file +flask-socketio \ No newline at end of file