Talk Python: Building Data-Driven Web Apps with Flask and SQLAlchemy
Michael Kennedy
  • Course duration: 9h 38m
Talk Python: Building Data-Driven Web Apps with Flask and SQLAlchemy is part of the exciting Talk Python course series from podcaster and software trainer Michael Kennedy. One of the areas where Python really shines is building clean and powerful web applications. This course teaches you the ins and outs of Python web development through an extensive hands-on example project and a visuals-first approach to learning. You’ll learn everything you need to build data-driven, modern web applications in Python with the Flask web framework.


Distributed by Manning Publications

This course was created independently by Python expert Michael Kennedy and is distributed by Manning through our exclusive liveVideo platform.

About the subject

Full stack web development requires mastering both good-looking frontend design and reliable backend infrastructure. The SQLAlchemy database toolkit is one of the most popular and powerful tools for writing Python classes and mapping them to your database, whilst the Flask framework is a super-lightweight choice that easily scales up to complex applications. Together, they make a great pairing for full-stack development with Python.

About the video

Talk Python: Building Data-Driven Web Apps with Flask and SQLAlchemy teaches you to build powerful web applications using nothing but Python tools. Rather than building lots of little demo websites, in this self-contained course you’ll learn by building a large and comprehensive web application based on Python's own packaging index. You’ll master important frontend skills such as working with HTML templates, and take advantage of Bootstrap to build well-designed sites with ease. Alongside beautiful server-side code, you’ll learn to map data to and from Python using classes with SQLAlchemy, to add client and server-side validation, and other important backend skills. Best of all, you'll learn a lot of web skills that will translate across the Python web frameworks, as well.
Table of Contents detailed table of contents

Welcome to the course

Introducing the course

The incredible power of web

What is fullstack development?

Student expectations and pre-reqs

The technologies we will learn

What can you build with Python?

Course topics

Meet your instructor

What app will we build for this course?

Setup

Do you have Python 3? How do you get it?

Our code editor

Git the source code

Following along

Introducing the Flask framework

What are microframeworks?

Building blocks of Flask

Building block: Views

Building block: Routes and URLs

Building block: Models

Building block: Dynamic HTML Templates

Get the back story

Your first Flask site

Introduction to creating a Flask website

Demo: CLI starter site

Concepts: CLI starter site

Demo: Creating the starter project PyCharm

Concept: Creating the starter project PyCharm

Project structure

Jinja2 templates

Template chapter introduction

Jinja2 template example

Create the PyPI site

Our first jinja template

Concept: Jinja2 templates

Layout: Motivation

Jinja2 autocomplete in PyCharm

Adding a simple nav element

Creating a common layout page

Better organization for your template files

Concepts: Common layout

Project structure with shared layout

Demo: @response a better render_template

Concept: @response a better render_template

Routing and URLs

Routing visualized

Demo: Routing, loading the project

Refactoring view methods with Flask blueprints

Concept: Refactoring view methods with Flask blueprints

Adding a constrained route

The account management routes

Concept: Create route from url

How to build a CMS in 8 minutes

Concept: Routing to add a custom CMS

Bootstrap and frontend CSS frameworks

What we’ll cover

CSS Front-end framework survey

Introduction to using Bootstrap

Running in a real web server

Intro to grid layout

Responsive browser tools

Grid layout in action

Adding to the grid

Concept: Grid layout

Buttons and forms

Buttons and forms in action

Style the login form

Concept: Buttons and forms

Why Bootstrap themes are awesome

Bootstrap theme tour

Adding our design

Our site design

Home page HTML

The making of the hero

Stats slice

New releases

Adding the navigation

Final footer

Modeling data with SQLAlchemy classes

Introducing SQLAlchemy

Who uses SQLAlchemy?

Architecture

The database model

Modeling packages

SQLAlchemy model base class

Connecting to our 'database'

Creating tables

Indexes

The rest of the tables

Relationships

Concepts: Modeling

Using SQLAchemy

Creating the basic insert script

Connecting to the database (again)

Setting package values

Saving the package to the db

Running the inserts

Adding type hints to the session factory

Inserting real PyPI data

Concept: Unit of work

Querying data: Home page

Querying data: Latest releases

Working with package details

Concept: Querying data

Concept: Ordering data

Concept: Database updates

Concept: Relationships

Concept: Inserting data

Database migrations with Alembic

Introducing database migrations

Getting started with Alembic

Our first change

More database changes

Concept: Getting started

Concept: Alembic - the manual version

Concept: auto-generating changes

User input and HTML forms

The basics of HTML input

GET-POST-Redirect pattern

Register for the site (getting started)

Registration form

A little design for the register form

Register POST action

Getting the submitted values

Creating the user

Login form

Login code

Creating a user session (cookies)

Navigation items based on user’s session

One source of data

Client and server-side validation

The motivation for viewmodels

Viewmodel base class

Using a viewmodel

The register viewmodel

Concept: Viewmodel

Simplified view methods

Viewmodel data exchange

Server-side validation with Viewmodels

Client-side validation with HTML5

Concept: Client-side validation with HTML5

Testing web apps

Why write tests (web)

Special challenges of the web

3 types of web unit tests

Organizing your tests

Getting started with tests

Testing the register viewmodel

Avoiding the database call on register

Testing registration when inputs are invalid

Concept: Testing view models

Testing view methods

Concept Testing view methods

Integrated tests

The rest of the tests

Running tests outside of PyCharm

Concept: Testing the full web app

Pareto principle and testing with sitemaps

Deployment

Deployment overview and topology

02-creating-our-linux-server

The setup script and config files

Configure the server

Make the virtual environment always active

Setting up our code

Running under uWSGI

uWSGI as a service

Running in nginx

Adding SSL with Let’s Encrypt

Concept: uWSGI

Concept: nginx

MongoDB edition

Introduction to the NoSQL version

Not a MongoDB course

How document databases work

Connecting to MongoDB

The user entity with mongoengine

Saving a user

The rest of the entities

Rewriting our queries

Fixing the login

Importing the data from SQL to Mongo

Home page cleanup

Package details cleanup

Concepts: MongoEngine and MongoDB

Course conclusion

You’ve done it!

Creating a new Flask app

Jinja2 templates and dynamic HTML

Layout pages

Routes

Themes

Querying data

Database migrations

GET-POST-Redirect

Viewmodels

Testing web apps

Deployment

MongoDB edition

Git the source code

Thanks and goodbye

Prerequisites

For learners with basic Python skills, and basic HTML/CSS experience.

What you will learn

  • Create a Flask-based website from scratch using CLI and PyCharm
  • Map URLs to view methods using routing
  • Make advanced use of routing to build a full custom CMS in 8 minutes
  • Map data to and from Python using classes with SQLAlchemy
  • Accept user input with HTML forms
  • Add client and server-side validation
  • Overcome the special challenges of testing web apps
  • Deploy your web application to a fresh, cloud-based Linux machine

About the instructor

Michael Kennedy is the host of the #1 Python podcast, Talk Python to Me. He’s interviewed many of the leaders and creators in the Python community and brings that perspective to all the courses he creates. He has been a professional software trainer for over 10 years.

placing your order...

Don't refresh or navigate away from the page.
liveVideo $49.00
Talk Python: Building Data-Driven Web Apps with Flask and SQLAlchemy (liveVideo) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.