We started this chapter by first introducing the concept of an application factory and described some of the benefits and trade-offs of this approach. Next, we used our newly created application factory to set up our first test suite using py.test
, which required some modification as to how our application object was created in order to ensure that we obtained a suitable instance that was configured to test scenarios.
Then, we dove headfirst into implementing the basic data models behind a typical web application that contained social features with the ability to follow other users and be followed ourselves. We briefly touched on several main implementation patterns for so-called newsfeed applications and used the simplest version for our own data models.
This then led us to discuss and explore the concept of the publish/subscribe design pattern, of which an in-process implementation can be found in the Blinker
package that Flask and various Flask extensions integrate. Using this new...