Deploying a Web app with Heroku
I will show in this post how you can proceed to deploy on internet your web application built with Python and I will show also how to embedded in your webpage.
I will be working on the following example:
First of all this dashboard is obtained with a Python code that I didn’t write it. I will show you in another notebook how can we create such code. But you can download it, like I did, from the following link. It’s better that you download the whole repository and keep in a local directory in your computer.
It’s recommended to run the app locally. Since this app is built using Bokeh Library you need to execute in your terminal the following command. Of course you have to work under the directory where your .py file is located:
bokeh serve --show appdhafer.py
$ heroku --version
heroku/7.0.0 (darwin-x64) node-v8.0.0
$ heroku --version
heroku/7.0.0 (darwin-x64) node-v8.0.0
$ heroku login
heroku: Press any key to open up the browser to login or q to exit
› Warning: If browser does not open, visit
› https://cli-auth.heroku.com/auth/browser/***
heroku: Waiting for login...
Logging in... done
Logged in as ********
Step 4 In order to allow also Heroku to deploy your web app, you need also to have a Github account and create a repository with the name given to your app: appdhafer. This repository should then contain the following four files:
Step 5 Now go back to your Heroku account and go to Dashboard
and you will obtain this page. Click then on Create app
.
create app
and the Heroku will take you to this pageManual Deploy
and click on Deploy Branch
. After few minutes, your app will be then deployed and ready to be embedded in your website.<iframe src="https://appdhafer.herokuapp.com/appdhafer" height="500" width="100%" frameBorder="0"></iframe>