Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Easy local testing and deployment to S3 of TableSetter tables.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 public
Octocat-spinner-32 tables
Octocat-spinner-32 views
Octocat-spinner-32 .gitignore
Octocat-spinner-32 COPYING
Octocat-spinner-32 README.textile
Octocat-spinner-32 config.example.py
Octocat-spinner-32 fabfile.py
Octocat-spinner-32 gzip_assets.py
Octocat-spinner-32 rename_tables.py
Octocat-spinner-32 requirements.txt
README.textile

Tostones: Single-click deployment of static TableSetter tables!

Description

Tostones is a Python deployment rig wrapped around the excellent “TableSetter”:“http://propublica.github.com/table-setter”/, which is itself a wrapper around “TableFu”:“http://propublica.github.com/table-fu/”, both productions of the fine nerds at “ProPublica”:“http://www.propublica.org/”.

Using Tostones one can render, gzip and deploy a collection of interactive, full-page tables to Amazon S3 for hosting. (Hosting with S3 has the dual benefits of being both resilient and cheap.) In addition to handling deployment, Tostones also provides a simple ‘runserver’ command for local testing.

Dependencies

To install the python requirements use pip (and virtualenv, of course):

% pip install -r requirements.txt

In addition to python requirements, this project requires the installation of the “table_setter” Ruby gem (which does all the hard work):

% gem install table_setter

If you are using Ruby 1.9, this will bring with it a dependency on FasterCSV, which inanely forces Ruby to stop executing when it is required in ruby>=1.9

To fix this, find the installed gems for table_setter and table_fu and change

require "fastercsv"

to

require "csv"

and then change references to FasterCSV to CSV.

Usage

Configure your installation by copying the example configuration and modifying as necessary:

% cp config.example.py config.py

You can, of course, use the traditional S3 magic of mapping bucket names to domain names so you can have pretty URLs.

Once you’ve updated your configuration, create your individual table config in the tables directory (see example.yml) and run:

% fab build_and_run

This will rebuild all your tables and launch a simple Python server for viewing the results. To view the results visit:

http://localhost:8000/

You can customize the table templates in the views folder. Once you are satisfied with them you can deploy them to your S3 staging bucket by running.

% fab staging deploy

Tostones includes an example that uses real data from one of our Chicago Tribune stories about speeding tickets. To see the finished product of this story with complete header and footer visit “http://media.apps.chicagotribune.com/tables/speed.html”:“http://media.apps.chicagotribune.com/tables/speed.html”.

License

Like TableSetter itself, Tostones is licensed under the MIT license. Do as you will.

Something went wrong with that request. Please try again.