fix in start

This commit is contained in:
Mateusz Gruszczyński
2026-03-01 23:35:45 +01:00
parent c1f280fb9e
commit ef6f81fe9e
2 changed files with 9 additions and 6 deletions

11
app.py
View File

@@ -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'])
socketio.run(
app,
host="0.0.0.0",
port=config.FLASK_CONFIG["port"],
allow_unsafe_werkzeug=True
)

View File

@@ -3,6 +3,4 @@ influxdb
#influxdb-client
simple-websocket
python-socketio
flask-socketio
gevent
gevent-websocket
flask-socketio