Tostones: Single-click deployment of static TableSetter tables!
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.
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
and then change references to FasterCSV to CSV.
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:
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”.
Like TableSetter itself, Tostones is licensed under the MIT license. Do as you will.