This tutorial shows you how to process text and then setup a task queue with Flask. In part one, we’ll set up a local development environment and then deploy both a staging environment and a production environment on Heroku.
Welcome! Today we’re going to start building a Flask app that calculates word-frequency pairs based on the text from a given URL. This is a full-stack tutorial.
- Part One: Set up a local development environment and then deploy both a staging and a production environment on Heroku. (current)
- Part Two: Set up a PostgreSQL database along with SQLAlchemy and Alembic to handle migrations.
- 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.
- Part Four: Implement a Redis task queue to handle the text processing.
- Part Five: Set up Angular on the front-end to continuously poll the back-end to see if the request is done processing.
- 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.
- Part Seven: Update the front-end to make it more user-friendly.
- Part Eight: Create a custom Angular Directive to display a frequency distribution chart using JavaScript and D3.
Need the code? Grab it from the repo.
Project Setup
We’ll start with a basic “Hello World” app on Heroku with staging (or pre-production) and production environments.
For the initial setup, you should have some familiarity with the following tools:
#flask #python #web-development