Book description
Design and deploy robust state-of-the-art web applications using Flask 2.x and Python 3 frameworks and libraries for streamlined development and optimal performance Purchase of the print or Kindle book includes a free PDF eBook
Key Features
- A practical and rich companion guide for web developers, offering real-world situations and use cases to learn Flask
- Get the most out of the powerful Flask framework while preserving the flexibility of your design choices
- Write cleaner, testable, and maintainable code with the help of sample apps
Book Description
Discover what makes Flask, the lightweight Python web framework, popular, as you delve into its modular design that enables the development of scalable web apps. With this practical guide, you'll explore modern solutions, recommended design patterns, and best practices for Flask web development.
Updated to the latest version of Flask and Python, this third edition of the Flask Framework Cookbook moves away from the outdated libraries, updates content to incorporate new coding patterns, and introduces recipes for the latest tools. You'll explore different ways to integrate with GPT to build AI-ready Flask applications. The book starts with an exploration of Flask application configurations and then guides you through working with templates and understanding the ORM and view layers. You’ll also be able to write an admin interface and get to grips with testing using the factory pattern, debugging, and logging errors. Then you’ll discover different ways of using Flask to create, deploy, and manage microservices using AWS, GCP, and Kubernetes. Finally, you’ll gain insights into various deployment and post-deployment techniques for platforms such as Apache, Tornado, and Datadog.
By the end of this book, you'll have acquired the knowledge necessary to write Flask applications that cater to a wide range of use cases in the best possible way and scale them using standard industry practices.
What you will learn
- Explore advanced templating and data modeling techniques
- Discover effective debugging, logging, and error-handling techniques in Flask
- Work with different types of databases, including RDBMS and NoSQL
- Integrate Flask with different technologies such as Redis, Sentry, and Datadog
- Deploy and package Flask applications with Docker and Kubernetes
- Integrate GPT with your Flask application to build future-ready platforms
- Implement continuous integration and continuous deployment (CI/CD) to ensure efficient and consistent updates to your Flask web applications
Who this book is for
If you are a web developer seeking to expand your knowledge of developing scalable and production-ready applications in Flask, this is the book for you. It is also highly valuable if you are already aware of Flask's major extensions and want to leverage them for better application development. This book will come handy as a quick reference for specific topic on Flask, its popular extensions, or specific use cases. It assumes basic Python programming experience, as well as familiarity with web development and related terminology.
Table of contents
- Flask Framework Cookbook
- Third Edition
- Contributors
- About the author
- About the reviewers
- Preface
- Part 1: Flask Fundamentals
-
Chapter 1: Flask Configurations
- Technical requirements
- Setting up a virtual environment
- Handling basic configurations
- Configuring using class-based settings
- Organizing static files
- Being deployment-specific with the instance folder
- Composition of views and models
- Creating a modular web app with blueprints
- Making a Flask app installable using setuptools
- Chapter 2: Templating with Jinja
- Chapter 3: Data Modeling in Flask
-
Chapter 4: Working with Views
- Writing function-based views and URL routes
- Writing class-based views
- Implementing URL routing and product-based pagination
- Rendering to templates
- Dealing with XHR requests
- Using decorators to handle requests beautifully
- Creating custom 4xx and 5xx error handlers
- Flashing messages for better user feedback
- Implementing SQL-based searching
- Part 2: Flask Deep Dive
- Chapter 5: Web Forms with WTForms
- Chapter 6: Authenticating in Flask
- Chapter 7: RESTful API Building
- Chapter 8: Admin Interface for Flask Apps
- Chapter 9: Internationalization and Localization
- Part 3: Advanced Flask
-
Chapter 10: Debugging, Error Handling, and Testing
- Setting up basic file logging
- Sending emails on the occurrence of errors
- Using Sentry to monitor exceptions
- Debugging with pdb
- Creating application factories
- Creating the first simple test
- Writing more tests for views and logic
- Integrating the nose2 library
- Using mocking to avoid external API access
- Determining test coverage
- Using profiling to find bottlenecks
- Chapter 11: Deployment and Post-Deployment
- Chapter 12: Microservices and Containers
- Chapter 13: GPT with Flask
- Chapter 14: Additional Tips and Tricks
- Index
- Other Books You May Enjoy
Product information
- Title: Flask Framework Cookbook - Third Edition
- Author(s):
- Release date: July 2023
- Publisher(s): Packt Publishing
- ISBN: 9781804611104
You might also like
book
Flask Framework Cookbook - Second Edition
Build state-of-the-art web applications quickly and efficiently using Flask and related technologies with Python 3 Key …
book
Flask Web Development, 2nd Edition
Take full creative control of your web applications with Flask, the Python-based microframework. With the second …
book
Full-Stack Flask and React
Get to grips with UI interaction, data modeling, API development, and documentation while building modern web …
book
Flutter and Dart Cookbook
Learn the essentials of working with Flutter and Dart to build full stack applications that meet …