Middleware and scaffolding for tornado-based webapps