
Hi,
I'm a newbie to Python, but not programming. However, my problem is replacing an antiquated web-based classroom-attendance oriented software app.
I need to serve out an environment where teachers can sign in and take attendance for students in their classrooms. That's the general idea. Python was recommended, but I've not used it before. So, I'm looking for directions on what the best overall components would be. I just so happened to have started with the web server first--Twisted Web was at the top of the list on the http://wiki.python.org/moin/WebServers page and seemed intriguing.
That's the background on my search/inquiry.
I think I'll need components to help with authenticating people, a database to capture attendance data, components to help with presenting data back to the user's browser, etc.
Any help is appreciated.
Thanks,
Ron ron@ronallensmith.com

On 07/01/2013 02:40 AM, Ron Allen Smith wrote:
Hi,
I'm a newbie to Python, but not programming. However, my problem is replacing an antiquated web-based classroom-attendance oriented software app.
I need to serve out an environment where teachers can sign in and take attendance for students in their classrooms. That's the general idea. Python was recommended, but I've not used it before. So, I'm looking for directions on what the best overall components would be. I just so happened to have started with the web server first--Twisted Web was at the top of the list on the http://wiki.python.org/moin/WebServers page and seemed intriguing.
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...
That's the background on my search/inquiry.
I think I'll need components to help with authenticating people, a database to capture attendance data, components to help with presenting data back to the user's browser, etc.
In which case for Twisted you'll need to research:
* core twisted concepts like async/nonblocking patters, the "deferred" pattern and use of the reactor * web, of course * cred, for authenticating users * adbapi, for talking to SQL * template, for generating HTML
See here:
http://twistedmatrix.com/documents/current/web/howto/web-in-60/index.html
...for a really good start.

On Jul 1, 2013, at 3:06 AM, Phil Mayers p.mayers@imperial.ac.uk 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 https://github.com/twisted/klein. Klein is a little bit higher level and helps you build the scaffolding necessary to assemble a site out of a bunch of objects.
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 :).
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 - https://github.com/clemesha/twisted-wsgi-django - since Django isn't really a WSGI app, it's a WSGI-plus-some-stuff app).
Twisted (mostly) a web server, for doling out resources, where as Django is (mostly) a web framework for developing web applications.
You can use either for either, of course; Twisted has a web app framework and Django has a built-in web server.
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.
The web-frameworky bits of Twisted tend to have advantages when one is making web interfaces to things which aren't 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.
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.
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: http://blog.futurefoundries.com/2013/05/announcing-crochet-07-easily-use.html.
Hope this is helpful!
-glyph

On 07/02/2013 01:24 AM, Glyph wrote:
On Jul 1, 2013, at 3:06 AM, Phil Mayers <p.mayers@imperial.ac.uk mailto:p.mayers@imperial.ac.uk> 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.

On 07/02/2013 02:45 AM, Phil Mayers wrote:
On 07/02/2013 01:24 AM, Glyph wrote:
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.
Same here. mod_auth_kerb is essential for enterprise web apps here, as it works with Active Directory (amazingly, M$ implemented the protocol correctly ;). I would love to use twisted here someday, but Kerberos auth is the blocker for now.
Steve

On 02/07/13 12:39, Stephen Waterbury wrote:
On 07/02/2013 02:45 AM, Phil Mayers wrote:
On 07/02/2013 01:24 AM, Glyph wrote:
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.
Same here. mod_auth_kerb is essential for enterprise web apps here, as it works with Active Directory (amazingly, M$ implemented the protocol correctly ;). I would love to use twisted here someday, but Kerberos auth is the blocker for now.
Ah, well as it happens...
http://twistedmatrix.com/trac/ticket/3532
;o)

On 07/02/2013 07:41 AM, Phil Mayers wrote:
On 02/07/13 12:39, Stephen Waterbury wrote:
On 07/02/2013 02:45 AM, Phil Mayers wrote:
On 07/02/2013 01:24 AM, Glyph wrote:
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.
Same here. mod_auth_kerb is essential for enterprise web apps here, as it works with Active Directory (amazingly, M$ implemented the protocol correctly ;). I would love to use twisted here someday, but Kerberos auth is the blocker for now.
Ah, well as it happens...
http://twistedmatrix.com/trac/ticket/3532
;o)
Yes, I remember that one ... "...testing kerberos is extremely hard." For sure. ;)
Steve
participants (4)
-
Glyph
-
Phil Mayers
-
Ron Allen Smith
-
Stephen Waterbury