Code Challenge 28 - Integrate a Bokeh Chart Into Flask

Michael Herman, Tue 18 July 2017, Challenges

Bokeh, codechallenges, data, Flask, guest, Heroku, RealPython, visualization

A smooth sea never made a skilled sailor. - Franklin D. Roosevelt

Hi Pythonistas, a new week, a new 'bite' of Python coding! We are delighted to have Michael Herman (Real Python) deliver this week's challenge. Prepare to learn some useful new skills and above all have fun!

Enter Michael.

The challenge

Create a Flask app that displays a basic data visualization with Bokeh.

If you're feeling up to it, deploy the app to Heroku as well.

Need some data to work with?

But you can use any data set. The goal is to use Bokeh inside Flask.

Suggested workflow

This challenge includes a number of moving pieces, so make sure to break it down into smaller steps.

For example:

  1. Create a basic Flask app
  2. Manually test the app locally
  3. Create a data visualization with Bokeh
  4. Integrate the Bokeh chart with the Flask app
  5. Manually test the app again locally

If you want more practice, burn it all down and start over again. Continue doing this until you feel comfortable with the workflow.

Bonus

Share your awesome visualization with the world:

  1. Set up Heroku and deploy
  2. Manually test the app on Heroku

Resources

Getting ready

See this INSTALL doc how to fork PyBites' challenges repo to get cracking.

This doc also provides you with instructions how you can submit your code to PyBites' community branch via Pull Request. PR submissions will be featured in next week's challenge review (previous editions).


Keep Calm and Code in Python!

-- Michael

PyBites Python Tips

Do you want to get 250+ concise and applicable Python tips in an ebook that will cost you less than 10 bucks (future updates included), check it out here.

Get our Python Tips Book

"The discussions are succinct yet thorough enough to give you a solid grasp of the particular problem. I just wish I would have had this book when I started learning Python." - Daniel H

"Bob and Julian are the masters at aggregating these small snippets of code that can really make certain aspects of coding easier." - Jesse B

"This is now my favourite first Python go-to reference." - Anthony L

"Do you ever go on one of those cooking websites for a recipe and have to scroll for what feels like an eternity to get to the ingredients and the 4 steps the recipe actually takes? This is the opposite of that." - Sergio S

Get the book