Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bendavidaaron/bdamilestone
Milestone Project for the Data Incubator
https://github.com/bendavidaaron/bdamilestone
bokeh flask heroku pandas
Last synced: 11 days ago
JSON representation
Milestone Project for the Data Incubator
- Host: GitHub
- URL: https://github.com/bendavidaaron/bdamilestone
- Owner: BenDavidAaron
- Created: 2017-09-10T21:39:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-18T21:55:41.000Z (about 6 years ago)
- Last Synced: 2024-11-17T08:36:50.015Z (2 months ago)
- Topics: bokeh, flask, heroku, pandas
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# final edit:
the app is [here](https://bda-stock-month.herokuapp.com/mile)# 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](https://lemurian.herokuapp.com) 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 ` or leave blank to
auto-generate a name.
- (Suggested) Use the [conda buildpack](https://github.com/kennethreitz/conda-buildpack).
If you choose not to, put all requirements into `requirements.txt``heroku config:add BUILDPACK_URL=https://github.com/kennethreitz/conda-buildpack.git`
The advantages of conda include easier virtual environment management and fast package installation from binaries (as compared to the compilation that pip-installed packages sometimes require).
One disadvantage is that binaries take up a lot of memory, and the slug pushed to Heroku is limited to 300 MB. Another note is that the conda buildpack is being deprecated in favor of a Docker solution.
- Deploy to Heroku: `git push heroku master`
- You should be able to see your site at `https://.herokuapp.com`
- A useful reference is the Heroku [quickstart guide](https://devcenter.heroku.com/articles/getting-started-with-python-o).## 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](http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html)
and [examples](https://github.com/bokeh/bokeh/tree/master/examples/embed).
- 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](https://realpython.com/blog/python/python-web-applications-with-flask-part-i/), especially the links in "Starting off", and [this tutorial](https://github.com/bev-a-tron/MyFlaskTutorial).