Packt Publishing recently sent me a copy of the eBook version of Flask Framework Cookbook by Shalabh Aggarwal. I didn't read it in its entirety as Cookbooks don't usually make for a very interesting linear read. I just went through it and cherry picked various recipes. But before I get into too much detail, let's do the quick review!
You can get this book in paperback, epub, mobi, or PDF.
The book is split up into 12 chapters covering 258 pages with over 80 recipes.
Packt is always putting out niche Python books. Flask is one of the more popular Python micro-web frameworks, so it probably has a good sized audience. Let's spend a few moments looking at what the chapters cover. In chapter one, we find out the many ways you can configure Flask. It contains information about using class based settings, static files, blueprints and more. Chapter two changes things up a bit with a group of recipes about Jinja, a templating language. In chapter three, we move into data modeling using SQLAlchemy. There are also recipes for Redis, Alembic and MongoDB. Chapter four is about working with views. It contains information on XHR requests, class-based views, custom 404 handlers and several other recipes.
In chapter five, the author focues on webforms with WTForms. Here we learn about field validation, uploading files and cross-site forgery. For chapter 6, we move into authentication recipes. There are recipes for the Flask-Login extension, OpenID, Facebook, Google and Twitter. Chapter 7 goes into RESTful API building. There are only four recipes in this chapter with two on creating different types of REST interfaces. The last recipe is a complete REST API example though. Chapter eight is all about the admin interface in Flask. Here you will learn about the Flask-Admin extension, custom forms, user roles and more!
Chapter nine takes us into Internationalization and localization. It has the fewest recipes at just 3. You learn how to add a new language, language switching and gettext/ngettext. Moving on to chapter ten, we learn about debugging, error handling and testing. Here we cover everything from emailing errors, to using the pdb debugger to nose, mock and coverage tests. Chapter 11 is about deployment. It covers recipes about apach, Gunicornm Tornado, Fabric, Heroku, AWS Elastic Beanstalk, Application monitoring and a few other items. Chapter 12 rounds out the book with other tips and tricks such as full-text search, working with signals, caching, Celery, etc.
Overall, I found the book fairly well written. There are some spots that are a bit choppy as I don't believe the author is a native English speaker, but the prose doesn't suffer very much because of this. Most of the recipes work well as standalone snippets. Sometimes the snippets don't seem to be completely runnable, but you should be able to download the full code from Packt. I didn't always find the groupings of recipes to be completely cohesive, but for the most part, they made sense together. I would recommend this book for a beginner in Flask that wants to take his skills to the next level and to those who need a more complete understanding of some of the things you can do with Flask.
Flask Framework Cookbook
by Shalabh Aggarwal
Copyright © 2021 Mouse Vs Python | Powered by Pythonlibrary