Skip to content
flask, heroku, environment variables, sqlalchemy, flask-migrate, redis
Branch: master
Clone or download
Pull request Compare This branch is even with realpython:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Flask by Example

Blog Posts

This is the repo for the Real Python blog series, Flask by Example -

  1. Part One: Set up a local development environment and then deploy both a staging and a production environment on Heroku.
  2. Part Two: Set up a PostgreSQL database along with SQLAlchemy and Alembic to handle migrations.
  3. Part Three: Add in the back-end logic to scrape and then process the word counts from a webpage using the requests, BeautifulSoup, and Natural Language Toolkit (NLTK) libraries.
  4. Part Four: Implement a Redis task queue to handle the text processing.
  5. Part Five: Set up Angular on the front-end to continuously poll the back-end to see if the request is done processing.
  6. Part Six: Push to the staging server on Heroku - setting up Redis and detailing how to run two processes (web and worker) on a single Dyno.
  7. Part Seven: Update the front-end to make it more user-friendly.
  8. Part Eight: Add the D3 library into the mix to graph a frequency distribution and histogram.

Check out

Quick Start

First Steps

$ pyvenv-3.5 env
$ source env/bin/activate
$ pip install -r requirements.txt

Set up Migrations

$ python db init
$ python db migrate
$ python db upgrade


Run each in a different terminal window...

# redis
$ redis server

# worker process
$ python

# the app
$ python
You can’t perform that action at this time.