d-ganchar / flask-cassandra-sessions

Server side sessions with Apache Cassandra

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Server side sessions with Apache Cassandra

The following code implements a session backend using Apache Cassandra.

Installation

pip install cassandra_flask_sessions

Configuring the database

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)
);

Usage

from flask import Flask
from cassandra_flask_sessions import CassandraSessionInterface

app = Flask(__name__)
app.session_interface = CassandraSessionInterface(keyspace='tests')

About

Server side sessions with Apache Cassandra

License:MIT License


Languages

Language:Python 100.0%