EuroPython 2010: Real Time Website in Python (live blog)

Speaker: Henrik Vendelbo

Henrik was giving an introduction to Tornado.

Web User Scenarios

  • RSS reader flagged/read/fav/...
  • show current status/price for a number of products
  • Ask the server to process an image
  • Routing chat between webapps
Means: lots of small requests to the server instead of big requests
This is a different type of traffic you see on the server. Each request not big but a lot of them. You need to react quickly.

Server Startup

Multi sub domain, auto-reloading process

shows example of tornado code doing it django like.

ioloop = tornado.ioloop.IOLoop.instance()
for n in structure.SITES:
    site = structure.SITES[n]
    if site['package'] in ("tornado", "mediaserver"):
        server = HTTPServer(Application(urls, site, uiloop=ioloop))
        server.listen(site['port'])
...


Handle Request / Server Response

  • basic tornado style, using regexp for matching routes
  • see http://tornadoweb.org/
  • Delayed Responses are doable via callbacks, e.g. on_response()
http://github.com/thepian

(this is a live blog article, corrections are welcome)

Posted