Basic template for using Flask on Heroku
HTML Python
Latest commit 1e2735e Sep 18, 2015 @gotoariel gotoariel update bootstrap
Failed to load latest commit information.
templates update bootstrap Sep 18, 2015
Procfile initial commit Aug 17, 2015 remove sub specifics to make repo generalizable Aug 26, 2015 initial commit Aug 17, 2015
conda-requirements.txt initial commit Aug 17, 2015
requirements.txt initial commit Aug 17, 2015
runtime.txt initial commit Aug 17, 2015

Flask on Heroku

This project is intended to help you tie together some important concepts and technologies from the 12-day course, including Git, Flask, JSON, Pandas, Requests, Heroku, and Bokeh for visualization.

The repository contains a basic template for a Flask configuration that will work on Heroku.

A finished example that demonstrates some basic functionality.

Step 1: Setup and deploy

  • Git clone the existing template repository.
  • Procfile, requirements.txt, conda-requirements.txt, and runtime.txt contain some default settings.
  • There is some boilerplate HTML in templates/
  • Create Heroku application with heroku create <app_name> or leave blank to auto-generate a name.
  • (Suggested) Use the conda buildpack. If you choose not to, put all requirements into requirements.txt

    heroku config:add BUILDPACK_URL=

  • Question: What are the pros and cons of using conda vs. pip?
  • Deploy to Heroku: git push heroku master
  • You should be able to see your site at https://<app_name>
  • A useful reference is the Heroku quickstart guide.

Step 2: Get data from API and put it in pandas

  • Use the requests library to grab some data from a public API. This will often be in JSON format, in which case simplejson will be useful.
  • Build in some interactivity by having the user submit a form which determines which data is requested.
  • Create a pandas dataframe with the data.

Step 3: Use Bokeh to plot pandas data

  • Create a Bokeh plot from the dataframe.
  • Consult the Bokeh documentation and examples.
  • Make the plot visible on your website through embedded HTML or other methods - this is where Flask comes in to manage the interactivity and display the desired content.
  • Some good references for Flask: This article, especially the links in "Starting off", and this tutorial.