Overview
Flask 3.1.1, released on May 13, 2025, fixes a secret key rotation issue and improves overall stability.
Main Features
Secret key rotation fix
Secret key rotation via SECRET_KEY_FALLBACKS is fixed to work correctly with sessions and CSRF tokens.
python
from flask import Flask
app = Flask(__name__)
app.config['SECRET_KEY'] = 'new-secret-key'
app.config['SECRET_KEY_FALLBACKS'] = [
'old-secret-key', # old key still valid
]
@app.route('/')
def index():
return 'Hello Flask 3.1.1!'
Stability fixes
Several bug fixes improve error handling and development server behavior.
python
from flask import Flask, jsonify
app = Flask(__name__)
@app.errorhandler(404)
def not_found(e):
return jsonify(error='Not found'), 404
# flask run --debug
