Learning Flask Framework

Build dynamic, data-driven websites and modern web applications with Flask
Preview in Mapt

Learning Flask Framework

Matt Copperwaite, Charles Leifer

1 customer reviews
Build dynamic, data-driven websites and modern web applications with Flask
Mapt Subscription
FREE
$29.99/m after trial
eBook
$7.20
RRP $35.99
Save 79%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$7.20
$44.99
$29.99p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Learning Flask Framework Book Cover
Learning Flask Framework
$ 35.99
$ 7.20
Flask Framework Cookbook Book Cover
Flask Framework Cookbook
$ 26.99
$ 18.90
Buy 2 for $24.70
Save $38.28
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781783983360
Paperback250 pages

Book Description

Flask is a small and powerful web development framework for Python. It does not presume or force a developer to use a particular tool or library. Flask supports extensions that can add application features as if they were implemented in Flask itself. Flask’s main task is to build web applications quickly and with less code. With its lightweight and efficient web development framework, Flask combines rapid development and clean, simple design.

This book will take you through the basics of learning how to apply your knowledge of Python to the web.

Starting with the creation of a “Hello world” Flask app, you will be introduced to the most common Flask APIs and Flask’s interactive debugger. You will learn how to store and retrieve blog posts from a relational database using an ORM and also to map URLs to views. Furthermore, you will walk through template blocks, inheritance, file uploads, and static assets.

You will learn to authenticate users, build log in/log out functionality, and add an administrative dashboard for the blog. Moving on, you will discover how to make Ajax requests from the template and see how the Mock library can simplify testing complex interactions.

Finally, you will learn to deploy Flask applications securely and in an automated, repeatable manner, and explore some of the most popular Flask resources on the web.

Table of Contents

Chapter 1: Creating Your First Flask Application
What is Flask?
Setting up a development environment
Installing Python packages
Creating your first Flask app
Introducing the blog project
Summary
Chapter 2: Relational Databases with SQLAlchemy
Why use a relational database?
Introducing SQLAlchemy
Creating the Entry model
Retrieving blog entries
Building a tagging system
Making changes to the schema
Summary
Chapter 3: Templates and Views
Introducing Jinja2
Creating a base template for the blog
Creating a URL scheme
Adding pagination links
Enhancing the blog app
Summary
Chapter 4: Forms and Validation
Getting started with WTForms
Using flash messages
Saving and modifying tags on posts
Serving static files
Summary
Chapter 5: Authenticating Users
Creating a user model
Installing Flask-Login
Creating user objects
Login and logout views
Accessing the current user
Restricting access to views
Sessions
Summary
Chapter 6: Building an Administrative Dashboard
Installing Flask-Admin
Exposing models through the Admin
Managing static assets via the Admin
Securing the admin website
Reading more
Summary
Chapter 7: AJAX and RESTful APIs
Creating a comment model
Installing Flask-Restless
Creating comments using AJAX
Loading comments using AJAX
Reading more
Summary
Chapter 8: Testing Flask Apps
Unit testing
Flask and unit testing
Test-friendly configuration
Mocking objects
Logging and error reporting
Read more
Summary
Chapter 9: Excellent Extensions
SeaSurf and CSRF protection of forms
Creating Atom feeds
Syntax highlighting using Pygments
Simple editing with Markdown
Caching with Flask-Cache and Redis
Creating secure, stable versions of your site by creating static content
Asynchronous tasks with Celery
Creating command line instructions with Flask-script
References
Summary
Chapter 10: Deploying Your Application
Running Flask with a WSGI server
Securing your site with SSL
Automating deployment using Ansible
Read more
Summary

What You Will Learn

  • Create your web pages to add modularity and flexibility to your web app using templates
  • Store and retrieve relational data using SQLAlchemy
  • Develop schema migrations with Alembic
  • Produce an admin section using flask-admin
  • Build RESTful APIs using Flask-Restless
  • Simulate requests and sessions using the Flask test client
  • Make Ajax requests from Jinja2 templates

Authors

Table of Contents

Chapter 1: Creating Your First Flask Application
What is Flask?
Setting up a development environment
Installing Python packages
Creating your first Flask app
Introducing the blog project
Summary
Chapter 2: Relational Databases with SQLAlchemy
Why use a relational database?
Introducing SQLAlchemy
Creating the Entry model
Retrieving blog entries
Building a tagging system
Making changes to the schema
Summary
Chapter 3: Templates and Views
Introducing Jinja2
Creating a base template for the blog
Creating a URL scheme
Adding pagination links
Enhancing the blog app
Summary
Chapter 4: Forms and Validation
Getting started with WTForms
Using flash messages
Saving and modifying tags on posts
Serving static files
Summary
Chapter 5: Authenticating Users
Creating a user model
Installing Flask-Login
Creating user objects
Login and logout views
Accessing the current user
Restricting access to views
Sessions
Summary
Chapter 6: Building an Administrative Dashboard
Installing Flask-Admin
Exposing models through the Admin
Managing static assets via the Admin
Securing the admin website
Reading more
Summary
Chapter 7: AJAX and RESTful APIs
Creating a comment model
Installing Flask-Restless
Creating comments using AJAX
Loading comments using AJAX
Reading more
Summary
Chapter 8: Testing Flask Apps
Unit testing
Flask and unit testing
Test-friendly configuration
Mocking objects
Logging and error reporting
Read more
Summary
Chapter 9: Excellent Extensions
SeaSurf and CSRF protection of forms
Creating Atom feeds
Syntax highlighting using Pygments
Simple editing with Markdown
Caching with Flask-Cache and Redis
Creating secure, stable versions of your site by creating static content
Asynchronous tasks with Celery
Creating command line instructions with Flask-script
References
Summary
Chapter 10: Deploying Your Application
Running Flask with a WSGI server
Securing your site with SSL
Automating deployment using Ansible
Read more
Summary

Book Details

ISBN 139781783983360
Paperback250 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Mastering Object-oriented Python Book Cover
Mastering Object-oriented Python
$ 26.99
$ 18.90
Flask Framework Cookbook Book Cover
Flask Framework Cookbook
$ 26.99
$ 18.90
Flask Framework Cookbook Book Cover
Flask Framework Cookbook
$ 26.99
$ 18.90
Mastering Python Design Patterns Book Cover
Mastering Python Design Patterns
$ 26.99
$ 18.90
Python Machine Learning Book Cover
Python Machine Learning
$ 35.99
$ 25.20
Functional Python Programming Book Cover
Functional Python Programming
$ 29.99
$ 21.00