Your SlideShare is downloading. ×
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Quick'n'Dirty Tornado Intro
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Quick'n'Dirty Tornado Intro

1,908

Published on

Slides for Lightining talk that I gave in PyCon Finland in Turku on 21.10.2010

Slides for Lightining talk that I gave in PyCon Finland in Turku on 21.10.2010

Published in: Technology, Design
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,908
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
35
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide













  • Transcript

    • 1. quick’n’dirty TORNADO intro Teemu Kurppa www.dirtyaura.org/blog Twitter: teemu Huikea Experience Social mobile gaming startup www.huikea.com
    • 2. TORNADO scalable, non-blocking web server
    • 3. TORNADO asynchronous requests simple clean DB API, no ORM programmer-friendly templates readable codebase proven in production: FriendFeed
    • 4. TORNADO Probably good for real-time web services (hanging GETs to poll) super-popular dynamic sites non-web REST services non-CMS sites for devs like me
    • 5. Our Tornado instance app cheap, async call Twitter
    • 6. Our Tornado instance db.slow_synchronous_query() cheap, async call ? Twitter
    • 7. Our Tornado instance cheap, async calls Another Tornado instance Twitter db.slow_synchronous_query()
    • 8. Programmer-friendly templates {% for index,value in entries.iteritems() %} {{ index }} : {{ value } {% end %} {% for value in entries %} {{ forloop.counter0 }} : {{ value }} {% endfor %}
    • 9. CODE DEMO
    • 10. class TwitterBadgeHandler(tornado.web.RequestHandler): @tornado.web.asynchronous def get(self, username): http = tornado.httpclient.AsyncHTTPClient() url = "http://api.twitter.com/1/users/show/%s.json" % username http.fetch(url, callback=self.on_response) def on_response(self, response): if response.error: self.render("badge_error.html") else: user = tornado.escape.json_decode(response.body) self.render("twitter_badge.html", **user)
    • 11. .... <style type="text/css"> .badge { background: #{{profile_background_color}} url({{profile_background_image_url}}); ... rest of wrapping and css left-out ... <div class="badge"> <img class="badge-photo” src="{{ profile_image_url }}"> <div class="badge-title">{{ screen_name }}</div> <div class="badge-description">{{ description }}</div> <div class="clear"></div> <div class="badge-status">{{ status['text'] }}</div> </div>

    ×