Deploy Bokeh Server Plots Using Heroku

This is a small blog post, guiding you with steps to deploy a bokeh python server plot using Heroku. There are very little resources online, that outline these processes. The documentation is not very clear (least I found it confusing, when different people suggest different methods) and hopefully this blog provides a clear guideline.

Assuming you’ve your server plot ready to be deployed, let’s begin by creating folders, in Github repository, that’d be required for heroku. My herokuapp GitHub repository has the following folders directory.

myapp (folder)
+—data (folder)
| +—data.csv
+—static (folder)
| +—images (folder)
| | +—images.png

This is how my repository looks like.

alt text

This is easy since this is how you’d have setup your folders to run the “myapp” locally in your system.

Now, go to and create a free account or login to your existing account.

Once you login, create a new app and remember the name of the app. We’d need to mention the app name in later steps.

The main part of the process, creating text documents for heroku, is the trickiest part. There are various answers online on creating these documents. I had to trial out few methods before getting it right.

So the whole myapp folder is within my main repository, herokuapp. Inside herokuapp, you’d have to create 3 more documents. Note that these file names are case sensitive.

  • Procfile
  • requirements.txt
  • runtime.txt


web: bokeh serve --port=$PORT --address= --use-xheaders myapp

This is where you’d have to mention your app name (created in heroku). replace “heroku_app_name” above with the name of your app. Don’t change anything else in the procfile. “myapp” in Procfile refers to the folder you’ve created within the GitHub repository.

This Procfile is similar to the command “bokeh serve --show myapp” that we’d run to display the server plot locally.



The issue I’d faced with requirements is that bokeh and tornado version has to be correct, to avoid timeout errors on heroku. So I figured it out (from stackoverflow and other GitHub bokeh chat) that tornado version has to be mentioned as 5.0.1. Apart from scikit-learn (which I needed for my code), all the other requirements are mandatory (bokeh server plot uses them). Incase you use other libraries in your python code, add them in the list along with their versions.



Note:- Heroku supports only 2.7.14 version, if your python version is 2.7.

Once you create the 3 files, the repository herokuapp looks like this.

herokuapp repository

herokuapp (GitHub repository)
+—myapp (folder)

Now it’s time to deploy the bokeh plot. You could use git commands to deploy the files from command/terminal, or you could manually deploy it from heroku dashboard (which I’d explain here).

Go to the heroku dashboard ( and select the app you’ve created. Once inside it, go to the “deploy” tab and select “Deployment method” as GitHub and connect your GitHub account with the app.

GitHub Connect

Once that is completed, scroll down and select the repository you’ve created for the bokeh plot. The repository can be selected from “App connected to GitHub” on the same deploy page. In my case, the repository is herokuapp.

Once that is done, you can either choose “Automatic deploy’, which will deploy and update the app automatically, every time you make a commit to the repository.

Else you could select “Manual deploy” and deploy the repository manually each time you update the repository. You can check build log inside “Build **master“**. Any error (in requirements/runtime txt files) will be shown here.

After successful deployment, you can view the app from

Note: Since you’re using a free version of herokuapp, there’d be some delay in rendering your plot online.

The app log (post deployment) can be seen by selecting more–> view logs in your app dashboard page.

app log

All the runtime issues and errors will be provided on the log.

You can find my bokeh server plot hosted here

Hope this blog post provides a clear explanation and helps you to deploy your own bokeh server plots on Heroku.

You can find my contact information on my contact page.

Any comments/feedback are always appreciated.


comments powered by Disqus