Closed frapples closed 8 months ago
same here. damned flask and his not supported batteries
Using app factory for testing. This problem is still there and driving me crazy. Please fix it! (There is already a PR commit https://github.com/fengsp/flask-session/pull/12/commits/1c1f7903184673682bd1d75432c8f455b62393a4)
If modifying db is not graceful:
for c in self.db.Model._decl_class_registry.values():
if hasattr(c, '__table__') and c.__table__.fullname == table:
self.sql_session_model = c
return
Before defining class Session
works for me
I'd like to update @AllanChain's response which worked wonders for me. It appears since sqlalchemy 1.4 (https://github.com/sqlalchemy/sqlalchemy/issues/6080) _decl_class_registry
has become depreciated and replaced with _class_registry
.
This issuse is now fixed from 0.7.0
This is create_app function:
Then exec this code:
An error occurred:
If I comment
sess.init_app(app)
, this code works fine.I guess that the two app instance shared the same database, repeat exec the function create_all(), my own definition of those tables can be created good, but the sessions table by using flask-session can not work in this situation.