views:

82

answers:

1

Hi,

I have a Django application which sometimes needs to send some data through TCP and I want this connection to be persistant.

The way I wanted to do it was to create a simple Twisted TCP server (I'm the one who will be waiting for the initial connection) and somehow call it from a Django view whenever I would be needing it.

How should the communication look like beetwen Twisted and Django in this case?

+3  A: 

Use the Twisted wsgi container to run Django. This container simply runs the WSGI application in multiple Twisted-threadpool threads, so you can simply call any Twisted API via blockingCallFromThread. There's really not that much to it!

Glyph
Although I didn't take this approach (a similar one though) I think that this should work as well. Anyway, Your answer led me to the solution, so thanks!
virtuallight