[Twisted-Python] Twisted protocol as Django data source

s s listsin at integrateddevcorp.com
Wed May 27 17:47:52 EDT 2009


On May 27, 2009, at 3:48 PM, Alex Clemesha wrote:

> On Wed, May 27, 2009 at 11:39 AM, Dan <charnedn at muohio.edu> wrote:
>> Hi all,
>>
>> I have an application written in Twisted which multiplexes data  
>> from a
>> variety of pieces of specialized hardware, and I'd like to make the
>> live stream of this information viewable through a webpage.
>> Unfortunately, on our server, port 80 is already taken by an Apache +
>> mod_python + Django stack with which we host a number of webpages.
>>
>> Ideally, I'd like to be able to write a quick Django app in which  
>> just
>> import my Twisted protocol, connect to my network, and start  
>> streaming
>> data. However, much googling has lead me to believe that this is
>> unlikely to actually work. (Particularly, http://twistedmatrix.com/pipermail/twisted-web/2007-March/003311.html
>> , which says that Twisted is simply not mod_python-friendly.)
>>
>> The options I've thought of include using Twisted's builtin web  
>> server
>> a nonstandard port, mod_proxy, or writing a Django app which just
>> polls a database repeatedly and altering my Twisted app so it
>> repeatedly does an UPDATE. All of these solutions feel hacky to me,  
>> so
>> I'd like to ask you, the list, how you'd go about doing this.
>
> I wrote up some thoughts on this here:
> http://clemesha.org/blog/2009/apr/23/Django-on-Twisted-using-latest-twisted-web-wsgi/
>
> basically it comes down to running Django off the very latest WSGI
> code (in the trunk still)
> found in twisted.web, which I've found to work very well.

I had some very strange errors and gave up and used CherryPy which  
worked right out of the box.  Has the Twisted WSGI changed much since  
the current release?  Did you have problems with the Twisted WSGI  
release version too and that's why you're running off trunk?

> Also see here:
> http://blog.dreid.org/2009/03/twisted-django-it-wont-burn-down-your.html

I followed those instructions, what there were of them, and got it  
running but it didn't seem to be able to serve static content.

I'd love it if the Twisted WSGI could run Django because the rest of  
my app relies on Twisted.

S







More information about the Twisted-Python mailing list