Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Flask Blueprints
  • Table Of Contents Toc
Flask Blueprints

Flask Blueprints

By : Joel Perras
3.3 (3)
close
close
Flask Blueprints

Flask Blueprints

3.3 (3)
By: Joel Perras

Overview of this book

Flask is a small but powerful web development framework for Python. Though Flask is termed a micro-framework, it is no way lacking in functionality; there are many extensions available to Flask which helps it to function at the same level as other large frameworks such as Django and Ruby on Rails. This book will demonstrate how to develop a series of web application projects with the Python web micro-framework, and leverage extensions and external Python libraries and APIs to extend the development of a variety of larger and more complex web applications. The book will start by explaining Python’s Virtualenv library and how to create and switch between multiple virtual environments. You’ll first build an SQL database-backed application, which will use Flask-WTF, Flask-SQLAlchemy, Jinja templates, and other methods. Next you’ll move on to a timeline application, built using concepts including pytest-Flask, the Blinker package, data modelling for user timelines, exception handling, and creating and organizing CLI tools. Moving on, you’ll discover how to implement a photo timeline application where you’ll explore topics such as writing and running celery tasks, API error handling and testing, and Werkzeug middlewares. Finally, the book walks you through creating an application which fetches data from GitHub and stores it locally. You will also learn how to install and configure Flask-Click extension.
Table of Contents (9 chapters)
close
close

Unit and functional testing

One of the primary benefits of implementing an application factory to hand out the Flask application instances is that we have the abilities to test the application more effectively. We can construct different application instances for different test cases and can be sure that they are as isolated from each other as possible (or as much as Flask/Werkzeug will allow).

The mainstay of the testing libraries in the Python ecosystem is unittest, which is included in the standard library and includes much of the functionalities that are expected of an xUnit framework. While a complete exposition on unittest is largely out of the scope of this book, a typical class-based test case will follow this basic skeleton, assuming that we are still using the factory pattern to separate our application configuration from instantiation:

from myapp import create_app
import unittest

class AppTestCase(unittest.TestCase):

    def setUp(self):
        app = create_app()  # Could also...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Flask Blueprints
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon