Introduction to Tornado

Modern Web Applications with Python

Michael Dory, Adam Parrish, Brendan Berg

Publisher: O'Reilly, 2012, 121 pages

ISBN: 978-1-449-30907-7

Keywords: Python, Web Programming

Last modified: May 17, 2012, 8:20 p.m.

Walk through the basics of Tornado, the high-performance web server known for its speed, simplicity, and scalability on projects large and small. With this hands-on guide, you’ll learn how to use Tornado’s acclaimed features by working with several example applications. You also get best practices for using Tornado in the real world.

Are you interested in creating a scalable social application, real-time analytics engine, or RESTful API — all with the power and simplicity of Python? This book shows you why Tornado is fantastic choice for writing powerful applications that are simple to create, extend, and deploy.

  • Learn how to use Tornado’s lightweight and flexible templating language
  • Extend templates to repurpose headers, footers, layout grids, and other content
  • Use persistent storage like MongoDB to store, serve, and edit dynamic content
  • Explore Tornado’s ability to make asynchronous web requests
  • Secure your application against cookie and request vulnerabilities
  • Authenticate with external services, using Tornado’s auth module
  • Adopt deployment strategies that help harden your application and increase request throughput
  1. Introduction
    • What Is Tornado?
      • Getting Started with Tornado
      • Community and Support
    • Simple Web Services
      • Hello Tornado
      • String Service
      • More About RequestHandlers
      • Next Steps
  2. Forms and Templates
    • Simple Example: Poem Maker Pro
      • Rendering Templates
      • Interpolation
    • Template Syntax
      • Interpolating Expressions
      • Control Flow Statements
      • Using Functions Inside Templates
    • Complete Example: The Alpha Munger
      • How It Works
      • Serving Static Files
      • Next Steps with Templates
  3. Extending Templates
    • Blocks and Substitutions
      • Basics of Blocks
      • Templates in Practice: Burt's Books
      • Autoescaping
    • UI Modules
      • Basic Module Usage
      • Modules in Depth
      • Embedding JavaScript and CSS
    • Summing Up
  4. Databases
    • Basic MongoDB Operations with PyMongo
      • Establishing a Connection
      • Dealing with Documents
      • MongoDB Documents and JSON
    • A Simple Persistent Web Service
      • A Read-Only Dictionary
      • Writing the Dictionary
    • Burt's Books
      • Reading Books (From the Database)
      • Editing and Adding Books
    • MongoDB: Next Steps
  5. Asynchronous Web Services
    • Asynchronous Web Requests
      • Starting Synchronous
      • The Trouble with Blocking
      • Basic Asynchronous Calls
      • The asynchronous Decorator and the finish Method
      • Asynchronous Generators
      • Summary of Asynchronous Operations
    • Long Polling with Tornado
      • The Benefits of Long Polling
      • Example: Live Inventory Reporting
      • The Downside of Long Polling
    • WebSockets with Tornado
      • Tornado's WebSocket Module
      • Example: Live Inventory with WebSockets
      • The Future of WebSockets
  6. Writing Secure Applications
    • Cookie Vulnerabilities
      • Cookie Forgery
      • Secure Cookies
    • Request Vulnerabilities
      • Anatomy of a Cross-Site Request Forgery
      • Defending Against Request Forgeries
      • Using Tornado's XSRF protection
    • User Authentication
      • Example: Welcome Back
      • The authenticated Decorator
    • Summing up
  7. Authenticating with External Services
    • The Tornado auth Module
      • The Authorization Workflow
      • Asynchronous Requests
    • Example: Sign in With Twitter
    • Example: Facebook Authentication and the Graph API
  8. Deploying Tornado
    • Reasons for Running Multiple Tornado Instances
    • Using Nginx as a Reverse Proxy
      • Basic Nginx Configuration
      • SSL Decryption with Nginx
    • Using Supervisor to Manage Tornado Processes

Reviews

Introduction to Tornado

Reviewed by Roland Buresund

Disappointing *** (3 out of 10)

Last modified: May 17, 2012, 8:21 p.m.

OK, I admit that I was excited when I ordered this book. When I got it, I was a bit surprised to find it very thin. Reading the ToC made it seem like a good buy, but when checking the contents I was let down. It contains loads of uncommented Python-code and some small nuggets of editorial narrative in between the code. It utterly fails to convey any meaning or reasoning why I should contemplate using Tornado. But it seems to believe that I should understand all equivalent stuff from other frameworks (like routes etc.), so it doesn't really explain anything.

To say I was disappointing, is the least that can be said! This is the reason why O'Reilly has gone from a respected publisher to one of the pack: idiotic books published because they have novelty value, without any quality assurance! Add to that the fact that they don't even have an index in the book, you start to question their editors as well…

When you start to check the authors, you begin to understand that they ain't maybe the best and the brightest bunch, but just opportunists. Avoid, this book, as it only makes someone else richer and doesn't give you anything useful in return.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required