Fix webapp.py for Python 3.13+ compatibility

- Remove deprecated eventlet dependency
- Use threading mode for Flask-SocketIO instead of eventlet
- eventlet is deprecated and has compatibility issues with Python 3.13
- Threading mode works reliably on all Python versions

This fixes the RuntimeError: Working outside of application context
errors when running webapp.py on Python 3.13.
parent 86fcdc95
......@@ -65,7 +65,8 @@ pydantic>=2.6.0
flask>=3.0.2
flask-cors>=4.0.0
flask-socketio>=5.3.6
eventlet>=0.36.0
# eventlet removed - deprecated and incompatible with Python 3.13
# Using threading mode for SocketIO instead
python-socketio>=5.11.0
werkzeug>=3.0.1
......
......@@ -34,10 +34,9 @@ from flask import Flask, request, jsonify, send_file, send_from_directory, Respo
from flask_cors import CORS
from flask_socketio import SocketIO, emit
from werkzeug.utils import secure_filename
import eventlet
# Enable eventlet for async operations
eventlet.monkey_patch()
# Note: Using threading mode instead of eventlet for Python 3.13+ compatibility
# eventlet is deprecated and has issues with newer Python versions
# Configuration
UPLOAD_FOLDER = Path.home() / ".config" / "videogen" / "webapp" / "uploads"
......@@ -62,7 +61,8 @@ app.config['MAX_CONTENT_LENGTH'] = 500 * 1024 * 1024 # 500MB max upload
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY', 'videogen-webapp-secret-key')
CORS(app)
socketio = SocketIO(app, cors_allowed_origins="*", async_mode='eventlet')
# Use threading mode for Python 3.13+ compatibility (eventlet is deprecated)
socketio = SocketIO(app, cors_allowed_origins="*", async_mode='threading')
# Job storage
@dataclass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment