Explore Flask
Robert Picard
Explore Flask
Free
Description
Contents
Reviews

This book is a collection of the best practices for using Flask. There are a lot of pieces to the average Flask application. You’ll often need to interact with a database and authenticate users, for example. In the coming pages I’ll do my best to explain the “right way” to do this sort of stuff. My recommendations aren’t always going to apply, but I’m hoping that they’ll be a good option most of the time.



Explore Flask is a book about best practices and patterns for developing web applications with Flask. The book was funded by 426 backers on Kickstarter in July 2013.



I finally released the book, after spending almost a year working on it. Almost immediately I was tired of managing distribution and limiting the book’s audience by putting it behind a paywall. I didn’t write a book to run a business, I wrote it to put some helpful content out there and help grow the Flask community. An HTML version is at https://exploreflask.com/

Language
English
ISBN
Unknown
Explore Flask
Preface
Assumptions
Assumptions
Audience
Versions
Preface
Living document
Conventions used in this book
Conventions used in this book
Each chapter stands on its own
Formatting
Easter eggs
Summary
Coding conventions
Let's have a PEP rally!
Let's have a PEP rally!
PEP 8: Style Guide for Python Code
PEP 257: Docstring Conventions
Relative imports
Summary
Coding conventions
Environment
Use virtualenv to manage your environment
Use virtualenv to manage your environment
virtualenvwrapper
Keeping track of dependencies
Manually tracking dependencies
Version control
Version control
What to keep out of version control
Debugging
Debugging
Debug Mode
Flask-DebugToolbar
Environment
Summary
Organizing your project
Definitions
Organization patterns
Organization patterns
Single module
Package
Blueprints
Summary
Organizing your project
Configuration
The simple case
Instance folder
Instance folder
Using instance folders
Secret keys
Minor environment-based configuration
Configuring based on environment variables
Summary
Configuration
Advanced patterns for views and routing
View decorators
View decorators
Authentication
Caching
Custom decorators
URL Converters
URL Converters
Built-in converters
Custom converters
Summary
Advanced patterns for views and routing
Blueprints
What is a blueprint?
Why would you use blueprints?
Where do you put them?
Where do you put them?
Functional structure
Divisional
Which one is best?
How do you use them?
How do you use them?
Basic usage
Using a dynamic URL prefix
Using a dynamic subdomain
Refactoring small apps to use blueprints
Refactoring small apps to use blueprints
Step 1: Divisional or functional?
Step 2: Move some files around
Step 3: Cut the crap
Step 4: Blueprint...ifi...cation or something
Step 5: Enjoy
Summary
Blueprints
Templates
A quick primer on Jinja
How to organize templates
Inheritance
Creating macros
Custom filters
Summary
Templates
Static files
Organizing your static files
Organizing your static files
Serving a favicon
Manage static assets with Flask-Assets
Manage static assets with Flask-Assets
Defining bundles
Using our bundles
Using filters
Summary
Static files
Storing data
SQLAlchemy
SQLAlchemy
Initializing the database
Alembic migrations
Summary
Storing data
Handling forms
Flask-WTF
Flask-WTF
CSRF Protection and validation
Custom validators
Rendering forms
Summary
Handling forms
Patterns for handling users
Email confirmation
Storing passwords
Authentication
Authentication
Flask-Login
Forgot your password
Summary
Patterns for handling users
Deployment
The Host
The Host
Amazon Web Services EC2
Heroku
Digital Ocean
The stack
The stack
Application runner
Nginx Reverse Proxy
Summary
Deployment
Conclusion
The book hasn't received reviews yet.