24 lines
583 B
Python
24 lines
583 B
Python
from .base import Session, SessionStore
|
|
from .json_store import JSONSessionStore
|
|
from .sqlite_store import SQLiteSessionStore
|
|
|
|
|
|
__all__ = [
|
|
"Session",
|
|
"SessionStore",
|
|
"JSONSessionStore",
|
|
"SQLiteSessionStore",
|
|
"get_session_store",
|
|
]
|
|
|
|
|
|
def get_session_store() -> SessionStore:
|
|
from .. import config
|
|
backend = config.SESSION_BACKEND
|
|
if backend == "sqlite":
|
|
return SQLiteSessionStore(config.SQLITE_PATH)
|
|
if backend == "json":
|
|
return JSONSessionStore(config.SESSION_DIR)
|
|
raise ValueError(f"Unsupported SESSION_BACKEND: {backend}")
|
|
|