Code from the book Flask Framework Cookbook - Shalabh Aggarwal (2nd Edition, Packt)
- Chapter 01 Flask Configurations
- 01 Intro
- 02 Setting up our environment with virtualenv
- 03 Handling basic configurations
- 04 Configuring using class-based settings
- 05 Organizing static files
- 06 Being deployment-specific with instance folders
- 07 Composition of views and models
- 08 Creating a modular web app with blueprints
- 09 Making a Flask app installable using setuptools
- Chapter 02 Templating with Jinja2
- 0 Intro
- 1 Bootstraping the recomended layout
- 2 Implementing block composition and layout inheritance
- 3 Creating a custom context processor
- 4 Creating a custom Jinja2 filter
- 5 Creating a custom macro for forms
- 6 Advanced date and time formatting
- Chapter 03 Data Modeling in Flask
- 01 Creating an SQLAlchemy DB instance
- 02 Creating a basic product model
- 03 Creating a relational category model
- 04 Migrating databases using Alembic and Flask-Migrate
- 05 Indexing model data with Redis
- 06 Opting for the NoSQL way with MongoDB
- 07 Working with Views
- 08 Writing function-based views and URL routes
- 09 A simple GET request
- 10 A simple POST request
- 11 A simple GET-POST request
- Chapter 04 Writing class-based views
- 1 Implementing URL routing and product-based pagination
- 2 Adding pagination to applications
- 3 Rendering to templates
- 4 Dealing with XHR requests
- 5 Using decorators to handle requests beautifully
- 6 Creating custom 404 and 500 handlers
- 7 Flashing messages for better user feedback
- 8 Implementing SQL-based searching
- Chapter 05 Webforms with WTForms
- 1 Representing SQLAlchemy model data as a form
- 2 Validating fields on the server side
- 3 Creating a common forms set
- 4 Creating custom fields and validation
- 5 Creating a custom widget
- 6 Uploading files via forms
- 7 Protecting applications from cross-site request forgery (CSRF)
- Chapter 06 Authenticating in Flask
- 1 Creating a simple session-based authentication
- 2 Authenticating using the Flask-Login extension
- 3 Using Facebook for authentication
- 4 Getting started
- 5 Using Google for authentication
- 6 Using Twitter for authentication
- 7 Authenticating with LDAP
- Chapter 07 RESTful API Building
- 1 Creating a class-based REST interface
- 2 Creating an extension-based REST interface
- 3 Creating a complete RESTful API
- Chapter 08 Admin Interface for Flask Apps
- 1 Creating a simple CRUD interface
- 2 Using the Flask-Admin extension
- 3 Registering models with Flask-Admin
- 4 Creating custom forms and actions
- 5 Using a WYSIWYG editor for textarea integration
- 6 Creating user roles
- Chapter 09 Internationalization and Localization
- 1 Adding a new language
- 2 Implementing lazy evaluation and the gettext-ngettext functions
- 3 Implementing the global language switching action
- Chapter 10 Debugging, Error Handling, and Testing
- 01 Setting up basic file logging
- 02 Sending emails on the occurrence of errors
- 03 Using Sentry to monitor exceptions
- 04 Debugging with pdb
- 05 Creating our first simple test
- 06 Writing more tests for views and logic
- 07 Nose library integration
- 08 Using mocking to avoid real API access
- 09 Determining test coverage
- 10 Using profiling to find bottlenecks
- Chapter 11 Deployment and Post-Deployment
- 1 Deploying with Apache
- 2 Deploying with uWSGI and Nginx
- 3 Deploying with Gunicorn and Supervisor
- 4 Deploying with Tornado
- 5 Using S3 storage for file uploads
- 6 Deploying with Heroku
- 7 Deploying with AWS Elastic Beanstalk
- 8 Managing and monitoring application performance with New Relic
- Chapter 12 Microservices and Containers
- 1 Containerization with Docker
- 2 Orchestrating containers with Kubernetes
- 3 Going serverless with Zappa on AWS Lambda
- Chapter 13 Other Tips and Tricks
- 1 Implementing full-text search with Whoosh
- 2 Implementing full-text search with Elasticsearch
- 3 Working with signals
- 4 Using caching with your application
- 5 Implementing email support for Flask applications
- 6 Understanding asynchronous operations
- 7 Working with Celery