alejcas / flask-session-plus Goto Github PK
View Code? Open in Web Editor NEWFlask Multiple Sessions Interface (combine multiple sessions with different backends)
License: MIT License
Flask Multiple Sessions Interface (combine multiple sessions with different backends)
License: MIT License
I'm actually trying to use the extension in a multi-session environment.
With the following configuration:
import redis
SESSION_CONFIG = [
# First session will store the password value on it's own cookie.
{
'cookie_name': 'fsp',
'session_type': 'secure_cookie',
'session_fields': ['password'],
},
# Second session will store any other values set on the Flask session on it's own secure cookie
{
'cookie_name': 'session',
'session_type': 'redis',
'session_fields': 'auto',
'client': redis.Redis(host='portainer-dc_redis-dc_1', port=6379, db=0)
}
]
my flask app doesn't start with the following log:
/home/marco/PycharmProjects/corkscrew/venv/bin/python /home/marco/PycharmProjects/corkscrew/wsgi.py
Traceback (most recent call last):
File "/home/marco/PycharmProjects/corkscrew/wsgi.py", line 2, in <module>
from app import app
File "/home/marco/PycharmProjects/corkscrew/app/__init__.py", line 13, in <module>
from flask_session_plus import Session
File "/home/marco/PycharmProjects/corkscrew/venv/lib/python3.10/site-packages/flask_session_plus/__init__.py", line 1, in <module>
from flask_session_plus.session import Session
File "/home/marco/PycharmProjects/corkscrew/venv/lib/python3.10/site-packages/flask_session_plus/session.py", line 2, in <module>
from flask_session_plus.backends import SecureCookieSessionInterface, FirestoreSessionInterface
File "/home/marco/PycharmProjects/corkscrew/venv/lib/python3.10/site-packages/flask_session_plus/backends.py", line 8, in <module>
from flask.helpers import total_seconds
ImportError: cannot import name 'total_seconds' from 'flask.helpers' (/home/marco/PycharmProjects/corkscrew/venv/lib/python3.10/site-packages/flask/helpers.py)
Process finished with exit code 1
Just before going mad, is flask-session-plus Flask==2.1.3 compatible?
Regards
I'm trying to create a new backend session using redis but with other serializer. But with the information available about add new backend session i can't do it.
Shall you increase the information about this please?
as document, it means "Include all", but not work.
app.config['SESSION_CONFIG'] = [
# Second session will store the user logged in inside the firestore sessions collection.
{
'cookie_name': 'SESS_ID',
'session_type': 'firestore',
'session_fields': [],
'client': firestore.Client(),
'collection': 'sessions',
},
]
Passing datetime object to total_seconds in flask helper it should be a timedelta
self.client.set(store_id, val, self._get_memcache_timeout(total_seconds(expires)))
Generates error in redis and memcache sessions
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.