<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jul 1, 2013, at 3:06 AM, Phil Mayers <<a href="mailto:p.mayers@imperial.ac.uk">p.mayers@imperial.ac.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">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...</span><br style="font-family: Monaco; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></blockquote><br></div><div>If you are going to use Twisted, consider using it in combination with Klein <<a href="https://github.com/twisted/klein">https://github.com/twisted/klein</a>>.  Klein is a little bit higher level and helps you build the scaffolding necessary to assemble a site out of a bunch of objects.</div><div><br></div><div>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 :).</div><br><div>Another combination, the one I would recommend, would be Django running under Twisted.  Twisted's WSGI container can run Django just fine (although it will need a little help - <<a href="https://github.com/clemesha/twisted-wsgi-django">https://github.com/clemesha/twisted-wsgi-django</a>> - since Django isn't really a WSGI app, it's a WSGI-plus-some-stuff app).</div><div><br></div><div>Twisted (mostly) a web <i>server</i>, for doling out resources, where as Django is (mostly) a web <i>framework</i> for developing web applications.</div><div><br></div><div>You can use either for either, of course; Twisted has a web app framework and Django has a built-in web server.</div><div><br></div><div>Although Twisted's web-frameworky bits (twisted.web.template, adbapi, cred, guard) are encouraged more for production use than Django's web-server-y bits (runserver.py), if you're developing a reasonably standard web app that just needs to manipulate a little database state, Django will be a lot easier to work with, not to mention fantastically documented.</div><div><br></div><div>The web-frameworky bits of Twisted tend to have advantages when one is making web interfaces to things which <i>aren't</i> simply database-backed HTML applications.  For example, a web interface which allows you to view live data-flows, or controls some kind of hardware.  Or, for developing the web interface for something which has a model that might also be accessed by other protocols, like IMAP, DNS, NNTP, and so on.</div><div><br></div><div>For example, Twisted doesn't have an ORM of any kind (since your state might live in any kind of database, or no database at all!), and it's still a bit of an open question in the community what the best way to interact with database-backed state from Twisted is.  By contrast, Django has an ORM that can automatically generate a web interface to allow administrators to manipulate any Django model in your application.</div><div><br></div><div>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: <<a href="http://blog.futurefoundries.com/2013/05/announcing-crochet-07-easily-use.html">http://blog.futurefoundries.com/2013/05/announcing-crochet-07-easily-use.html</a>>.</div><div><br></div><div>Hope this is helpful!</div><div><br></div><div>-glyph</div></body></html>