An Introduction to Flask
This repository contains the software that accompanies my O'Reilly training video An Introduction to Flask.
Instructions on how to use these examples is included in the appropriate segments of the class.
Contents
If you want to have an idea of the contents of this class, below is a list of the projects included in this repository.
- 1a: Hello, World, Flask version.
- 1b: Dynamic routes.
- 2a: Templates, and the
render_template()
function. - 2b: Rendering lists of elements in templates.
- 2c: Rendering data structures.
- 2d: Using template variables and conditionals.
- 2e: Using template macros.
- 2f: Implementing templates with Twitter Bootstrap and the Flask-Bootstrap extension.
- 2g: Custom error pages, and template inheritance.
- 2h: Page links with the
url_for()
function. - 3a: Introduction to web forms and Flask's
request
object. - 3b: Managing forms with the Flask-WTF extension.
- 3c: Rendering Bootstrap forms with Flask-Bootstrap.
- 3d: File uploads.
- 4a: Using Flask's
session
context object. - 4b: Request hooks, and the
g
context object. - 4c: Example of many ways to create responses to requests.
- 5a: Introduction to relational databases and the Flask-SQLAlchemy extension.
- 6a: Password hashing.
- 6b: Logging users in and out with the Flask-Login extension.
- 7a: Refactoring of the single script 6b application as a scalable project structure.
- 8a: Unit tests.
- 8b: Testing routes using the Flask test client.
- 8c: Additional tests based on coverage reports.
- 9a: Production mode change to send emails to administrators when a crash occurs.
- 9b: Example application to deploy to Heroku.
- 9c: Example application to deploy to a Linux server.