Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Flask Blueprints

You're reading from   Flask Blueprints Dive into the world of the Flask microframework to develop an array of web applications

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781784394783
Length 198 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Joel Perras Joel Perras
Author Profile Icon Joel Perras
Joel Perras
Arrow right icon
View More author details
Toc

What this book covers

Chapter 1, Starting on the Right Foot – Using Virtualenv, kicks off our dive into Python web application development with the basics of using and managing virtual environments to isolate the application dependencies. We will look at the setup tools, pip, libraries, and utilities that are used to install and distribute reusable packages of Python code, and virtualenv, a tool to create isolated environments for the Python-based software requirements of a project. We will also discuss what these tools are not able to do, and look at the virtualenvwrapper abstraction to augment the functionality that virtualenv provides.

Chapter 2, Small to Big – Growing the Flask Application Structure, explores the various baseline layouts and configurations that you might consider for a Flask application. The pros and cons of each approach are outlined as we progress from the simplest one-file application structure to the more complex, multipackage Blueprint architecture.

Chapter 3, Snap – the Code Snippet Sharing Application, builds our first simple Flask application centered around learning the basics of one of the most popular relational database abstractions, SQLAlchemy, and several of the most popular Flask extensions: Flask-Login to handle authenticated user login sessions, Flask-Bcrypt to ensure that account passwords are stored in a secure manner, and Flask-WTF to create and process form-based input data.

Chapter 4, Socializer – the Testable Timeline, builds a very simple data model for a social web application where the main focus is on unit and functional testing using pytest, the Python testing framework and tools. We will also explore the use of the application factory pattern, which allows us to instantiate separate versions of our application for the purposes of simplifying testing. Additionally, the use and creation of often-omitted (and forgotten) signals, provided by the Blinker library, are described in detail.

Chapter 5, Shutterbug, the Photo Stream API, builds a skeleton of an application around a JSON-based API, which is a requirement for any modern web application these days. One of the many API-based Flask extensions, Flask-RESTful, is used to prototype the API, where we also delve into simple authentication mechanisms for stateless systems and even write a few tests along the way. A short detour is made into the world of Werkzeug, the WSGI toolkit that Flask is built upon, to build a custom WSGI middleware that allows the seamless handling of URI-based version numbers for our nascent API.

Chapter 6, Hublot – Flask CLI Tools, covers a topic that is often omitted from most web application framework discussions: command-line tools. The use of Flask-Script is explained, and several CLI-based tools are created to interact with the data models of our application. Additionally, we will build our very own custom Flask extension that wraps an existing Python library to fetch the repository and issue information from the GitHub API.

Chapter 7, Dinnerly – Recipe Sharing, introduces the somewhat intimidating concept of the OAuth authorization flow that many large web applications, such as Twitter, Facebook, and GitHub, implement in order to allow third-party applications to act on behalf of the account owners without compromising basic account security credentials. A barebones data model is constructed for a recipe-sharing application that allows the so-called social sign in and the ability to cross-post the data from our application to the feeds or streams of the services that a user has connected. Finally, we will introduce the concept of database migrations using Alembic, which allow you to synchronize your SQLAlchemy model metadata with the schemas of the underlying relational database tables in a reliable manner.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image