Skip to content
This repository has been archived by the owner on Aug 16, 2018. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Copyright 2013 NPR. All rights reserved. No part of these materials may be reproduced, modified, stored in a retrieval system, or retransmitted, in any form or by any means, electronic, mechanical or otherwise, without prior written permission from NPR.

(Want to use this code? Send an email to!)


Install requirements

Node.js is required for the static asset pipeline. If you don't already have it, get it like this:

brew install node
curl | sh

Then install the project requirements:

npm install
mkvirtualenv $NEW_PROJECT_NAME
pip install -r requirements.txt

Adding a template/view

A site can have any number of rendered templates (i.e. pages). Each will need a corresponding view. To create a new one:

  • Add a template to the templates directory. Ensure it extends _base.html.
  • Add a corresponding view function to Decorate it with a route to the page name, i.e. @app.route('/filename.html')
  • By convention only views that end with .html and do not start with _ will automatically be rendered when you call fab render.

Run the project locally

First setup your local live-data files:

cp data/radio-off.json www/live-data/radio.json
fab update_backchannel

Export the tumblr OAuth tokens:


Update your hosts file to assign localhost to the domain so that authentication will work. Do something like sudo nano -w /etc/hosts and add a line at the bottom like

A flask app is used to run the project locally. It will automatically compile templates and assets on demand.


Visit in your browser.

Running the Javascript tests

With your local server running, visit http://localhost:8000/test/SpecRunner.html.

Compile with static assets

Compile LESS to CSS, compile javascript templates to Javascript and minify all assets:

fab render

(This is done automatically whenever you deploy to S3.)

Test the rendered app

If you want to test the app once you've rendered it out, just use the Python webserver:

cd www
python -m SimpleHTTPServer

Deploy to S3

fab staging master deploy

Deploy to a server

The current configuration is for running cron jobs only. Web server configuration is not included.

  • In set env.deploy_to_servers to True.
  • Run fab staging master setup to configure the server.
  • Run fab staging master deploy to deploy the app.

Cron jobs

Cron jobs live as bash scripts inside /cron/ in the repository root.

  • Download, reformat and cache Tumblr postcards to JSON on S3.
* * * * * /home/ubuntu/apps/inauguration/repository/cron/mr_president

Output functions

  • fab write_mr_president_json writes a JSON cache of Tumblr postcards to /www/live-data/ and uploads it to S3. Replaces from the main repository.
  • fab generate_new_oauth_tokens generates new OAuth tokens for our Tumblr account. WARNING: This will invalidate the old tokens and you'll need to update the token exports in /etc/init/inauguration.conf. Replaces from the main repository.
  • fab write_mr_president_test_posts writes test postcards to our Tumblr blog. Choose the number by setting the constant. This will also add random tags to the postcards. Replaces from the main repository.
  • fab dump_tumblr_json will roll through pages of the Tumblr API and dump JSON for the posts to files in /data/backups/ for reconstitution. We do not have a script to reconstitute from this dump yet.


NPR Inauguration 2013 live chat (built on Scribble Live) and "Dear Mr. President" listener call-out (built on Tumblr)







No releases published


No packages published