librelist archives

« back to archive

run twisted reactor under Flask server

run twisted reactor under Flask server

From:
Vassili Gontcharov
Date:
2013-03-09 @ 21:26
Hi Alls,
I use Flask with SocketIOServer and it works well.
Now I have to use the twisted under Flask to connect a external
server, a library what I use comes  with twisted.

I tried to use the twisted reactor under my Flask development server
but something look like blocked until Ctrl+C
Any idea


-- 
Vassili

Re: [flask] run twisted reactor under Flask server

From:
Wouter Bolsterlee
Date:
2013-03-13 @ 21:05
Vassili Gontcharov schreef op za 09-03-2013 om 22:26 [+0100]:
> I tried to use the twisted reactor under my Flask development server
> but something look like blocked until Ctrl+C

That's likely because you run the main loop in Twisted (the reactor)
as a blocking call from the same thread that serves your web requests.
Try using a background thread instead.

    — Wouter