https://github.com/realpython/flask-by-example
flask, heroku, environment variables, sqlalchemy, flask-migrate, redis
https://github.com/realpython/flask-by-example
Last synced: 2 months ago
JSON representation
flask, heroku, environment variables, sqlalchemy, flask-migrate, redis
- Host: GitHub
- URL: https://github.com/realpython/flask-by-example
- Owner: realpython
- Created: 2014-08-12T20:32:29.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-07-25T05:38:43.000Z (over 5 years ago)
- Last Synced: 2025-05-24T12:06:50.582Z (7 months ago)
- Language: Python
- Homepage: https://realpython.com/learning-paths/flask-by-example/
- Size: 25.6 MB
- Stars: 681
- Watchers: 37
- Forks: 273
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flask by Example
## Blog Posts
This is the repo for the Real Python blog series, Flask by Example -
1. [Part One](https://realpython.com/blog/python/flask-by-example-part-1-project-setup/): Set up a local development environment and then deploy both a staging and a production environment on Heroku.
1. [Part Two](https://realpython.com/blog/python/flask-by-example-part-2-postgres-sqlalchemy-and-alembic): Set up a PostgreSQL database along with SQLAlchemy and Alembic to handle migrations.
1. [Part Three](https://realpython.com/blog/python/flask-by-example-part-3-text-processing-with-requests-beautifulsoup-nltk/): 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.
1. [Part Four](https://realpython.com/blog/python/flask-by-example-implementing-a-redis-task-queue/): Implement a Redis task queue to handle the text processing.
1. [Part Five](https://realpython.com/blog/python/flask-by-example-integrating-flask-and-angularjs/): Set up Angular on the front-end to continuously poll the back-end to see if the request is done processing.
1. [Part Six](https://realpython.com/blog/python/updating-the-staging-environment/): Push to the staging server on Heroku - setting up Redis and detailing how to run two processes (web and worker) on a single Dyno.
1. [Part Seven](https://realpython.com/blog/python/flask-by-example-updating-the-ui/): Update the front-end to make it more user-friendly.
1. Part Eight: Add the D3 library into the mix to graph a frequency distribution and histogram.
Check out http://realpython.com
## Quick Start
### First Steps
```sh
$ pyvenv-3.5 env
$ source env/bin/activate
$ pip install -r requirements.txt
```
### Set up Migrations
```sh
$ python manage.py db init
$ python manage.py db migrate
$ python manage.py db upgrade
```
### Run
Run each in a different terminal window...
```sh
# redis
$ redis server
# worker process
$ python worker.py
# the app
$ python app.py
```