Re: Where to begin

Phil Mayers <[email protected]> Tue, 02 Jul 2013 07:45:39 +0100
Newsgroups gmane.comp.python.twisted.web
Message-ID <[email protected]>
On 07/02/2013 01:24 AM, Glyph wrote:
>
> On Jul 1, 2013, at 3:06 AM, Phil Mayers <[email protected]
> <mailto:[email protected]>> wrote:
>
>> I love Twisted, but... consider carefully if an asynchronous webserver
>> is what you need. A more traditional framework, like Django running
>> under Apache/mod_wsgi, may suit your needs. Then again, it may not...
>
> If you are going to use Twisted, consider using it in combination with
> Klein

Hey, that's neat. I hadn't seen that before.

> However, I think Phil's correct insofar as he recommends that Django
> might be better suited towards the web application parts of your
> problem.  mod_wsgi, though?  No need for that :).

FWIW the main reasons we use Apache/mod_wsgi (aside from it being a 
recommended deployment model) are the plethora of features available in 
Apache, including mod_auth_kerb, mod_cosign, and various other 
authentication handlers.

Does the Twisted/Django integration run multi-threaded or multi-process? 
Because the latter obviously dodges the GIL, the former not.

> Twisted (mostly) a web /server/, for doling out resources, where as
> Django is (mostly) a web /framework/ for developing web applications.

I should add it's a really rather good web server, and is very useful if 
you don't want to worry about thread/process pool size issues with 
long-running requests. This is where Twisted shines; want 500 
simultaneous XMLRPC requests which wait on a 10-20 second timeout, but 
not a thread/process pool 500-big? Easy.

> Plus, if you use Django to develop your application but run it within a
> Twisted WSGI container, you can leverage the power of Twisted at any
> time.  Itamar has even recently released a tool to help you do this
> almost automatically, Crochet:

That I did know about, but had forgotten - thanks for pointing it out.