Well, in the same part of the docs, it's also said, that you can use Contextual/Thread-local sessions, explaining how to do that http://docs.sqlalchemy.org/en/latest/orm/session.html#unitofwork-contextual
On Thu, Feb 6, 2014 at 10:33 AM, Michael Rau <[email protected]> wrote: > 2014-02-06 17:50 GMT+00:00 Jeff Dairiki <[email protected]>: > > I don't know enough about flask to say how you might go about doing this. >> In pyramid, for example, you would most likely use a "tween" to commit or >> rollback the session, then close it at the end of each request. (Or >> use the transaction, zope.sqlalchemy, and pyramid_tm packages which >> together >> would do this for you.) >> > > Actually flask + sqlalchemy integration clearly says, that the session is > managed in the background. BUT the link you provided provided me with > another thing. It says: > > > Is the session thread-safe? > > The Session is very much intended to be used in a non-concurrent > fashion, which usually means in only one thread at a time. > > So I set uwsgi options to > > + processes = 4 > + threads = 1 > > and that worked. So actually it wasn't the processes, it was the number of > threads. Best practice obviously is to work with max. 1 thread under uwsgi > + flask + sqlalchemy. > > Thank you very much for your support! > > Michael. > > _______________________________________________ > uWSGI mailing list > [email protected] > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi > >
_______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
