The following code implements a session backend using Apache Cassandra.
pip install cassandra_flask_sessions
To create the table in the Cassandra database, you need the execute the following CQL commands:
USE tests;
DROP TABLE IF EXISTS sessions;
CREATE TABLE IF NOT EXISTS sessions (
sid text,
data text,
PRIMARY KEY(sid)
);
from flask import Flask
from cassandra_flask_sessions import CassandraSessionInterface
app = Flask(__name__)
app.session_interface = CassandraSessionInterface(keyspace='tests')