<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 20, 2011, at 3:33 PM, Jeroen van Veen wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Menlo; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">For this websocket cms project im working on, i also run django in a wsgi container. I wonder if im using &nbsp;it the right way? (<a href="https://github.com/phrearch/hwios/blob/master/services/web_ui/service.py">https://github.com/phrearch/hwios/blob/master/services/web_ui/service.py</a>)</span><br class="Apple-interchange-newline"></blockquote></div><br><div>Generally, yes, except for the "MainThreadWSGIResource" part.</div><div><br></div><div>First of all: you're taking your life in your own hands when you use a Twisted API that starts with a single underscore :-). &nbsp;<a href="http://twistedmatrix.com/trac/wiki/CompatibilityPolicy">http://twistedmatrix.com/trac/wiki/CompatibilityPolicy</a></div><div><br></div><div>Second, _WSGIResponse _does_ run the response in a thread; your code isn't doing what it claims to be doing. &nbsp;The right way to do this is not to override the WSGI layer, but to provide a fake threadpool whose 'callInThread' just calls the given callable on the main thread.</div><div><br></div><div>+1 for having a "plasmoids" module, by the way - does this software control a magnetically regulated plasma reaction at some point? :).</div><div><br></div><div>-glyph</div><div><br></div></body></html>