我建設與龍捲風+ SQLAlchemy的和絕對的隨機我得到這個錯誤的SQLAlchemy +龍捲風:無法重新連接,直到無效事務回滾
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception
exc_info
File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 187, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=exc_value)
File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 182, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 822, in _execute_context
conn = self._revalidate_connection()
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 239, in _revalidate_connection
"Can't reconnect until invalid "
sqlalchemy.exc.StatementError: Can't reconnect until invalid transaction is rolled back
我無法弄清楚如何解決web應用程序這個。我已將所有db.commit放入一個
try:
self.db.commit()
except Exception(e):
self.db.rollback()
這就是我的類應用程序。
class Application
[...]
engine = create_engine(options.db_path, convert_unicode=True, echo=options.debug)
models.init_db(engine)
self.db = scoped_session(sessionmaker(bind=engine))
tornado.web.Application.__init__(self, handlers, **settings)
但沒有。 爲mysql + php等web應用程序配置sqlalchemy和龍捲風的最佳方式是什麼?
這也是我的問題。用獵鷹框架+ gevent + uwsgi – Farsheed 2014-12-28 18:54:45
@FaraonWEB你有沒有解決這個問題? – pregmatch 2015-02-25 15:52:31