Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Cover
Table of Contents
Flask: Building Python Web Services
Flask: Building Python Web Services
Flask: Building Python Web Services
Credits
Preface
What you need for this learning path
Who this learning path is for
Reader feedback
1. Module 1
1. Hello, World!
Creating our development environment
Writing "Hello, World!"
Deploying our application to production
Summary
2. Getting Started with Our Headlines Project
Creating a new Flask application
Introduction to RSS and RSS feeds
Summary
3. Using Templates in Our Headlines Project
Basic use of Jinja templates
Advanced use of Jinja templates
Summary
4. User Input for Our Headlines Project
Getting user input using HTTP POST
Adding weather and currency data
Summary
5. Improving the User Experience of Our Headlines Project
Adding CSS to our Headlines application
Summary
6. Building an Interactive Crime Map
Understanding relational databases
Installing and configuring MySQL on our VPS
Creating our Crime Map database in MySQL
Creating a basic database web application
Summary
7. Adding Google Maps to Our Crime Map Project
Adding an embedded Google Maps widget to our application
Adding an input form for new crimes
Displaying existing crimes on our map
Summary
8. Validating User Input in Our Crime Map Project
Trying out an XSS example
Validating and sanitizing
Summary
9. Building a Waiter Caller App
Using Bootstrap to kick-start our application
Adding user account control to our application
Summary
10. Template Inheritance and WTForms in Waiter Caller Project
Shortening URLs using the bitly API
Adding functionality to handle attention requests
Adding user feedback with WTForms
Summary
11. Using MongoDB with Our Waiter Caller Project
Installing MongoDB
Using the MongoDB shell
Introducing PyMongo
Testing our application in production
Adding some finishing touches
Summary
A. A Sneak Peek into the Future
Expanding your Flask knowledge
Expanding your web development knowledge
Summary
2. Module 2
1. Flask Configurations
Environment setup with virtualenv
Handling basic configurations
Class-based settings
Organization of static files
Being deployment specific with instance folders
Composition of views and models
Creating a modular web app with blueprints
Making a Flask app installable using setuptools
2. Templating with Jinja2
Bootstrap layout
Block composition and layout inheritance
Creating a custom context processor
Creating a custom Jinja2 filter
Creating a custom macro for forms
Advanced date and time formatting
3. Data Modeling in Flask
Creating a SQLAlchemy DB instance
Creating a basic product model
Creating a relational category model
Database migration using Alembic and Flask-Migrate
Model data indexing with Redis
Opting the NoSQL way with MongoDB
4. Working with Views
Writing function-based views and URL routes
Class-based views
URL routing and product-based pagination
Rendering to templates
Dealing with XHR requests
Decorator to handle requests beautifully
Creating custom 404 and 500 handlers
Flashing messages for better user feedback
SQL-based searching
5. Webforms with WTForms
SQLAlchemy model data as form representation
Validating fields on the server side
Creating a common forms set
Creating custom fields and validation
Creating a custom widget
Uploading files via forms
Cross-site Request Forgery protection
6. Authenticating in Flask
Simple session-based authentication
Authenticating using the Flask-Login extension
Using OpenID for authentication
Using Facebook for authentication
Using Google for authentication
Using Twitter for authentication
7. RESTful API Building
Creating a class-based REST interface
Creating an extension-based REST interface
Creating a SQLAlchemy-independent REST API
A complete REST API example
8. Admin Interface for Flask Apps
Creating a simple CRUD interface
Using the Flask-Admin extension
Registering models with Flask-Admin
Creating custom forms and actions
WYSIWYG for textarea integration
Creating user roles
9. Internationalization and Localization
Adding a new language
Lazy evaluation and the gettext/ngettext functions
Global language-switching action
10. Debugging, Error Handling, and Testing
Setting up basic file logging
Sending e-mails on the occurrence of errors
Using Sentry to monitor exceptions
Debugging with pdb
Creating our first simple test
Writing more tests for views and logic
Nose library integration
Using mocking to avoid real API access
Determining test coverage
Using profiling to find bottlenecks
11. Deployment and Post Deployment
Deploying with Apache
Deploying with uWSGI and Nginx
Deploying with Gunicorn and Supervisor
Deploying with Tornado
Using Fabric for deployment
S3 storage for file uploads
Deploying with Heroku
Deploying with AWS Elastic Beanstalk
Application monitoring with Pingdom
Application performance management and monitoring with New Relic
12. Other Tips and Tricks
Full-text search with Whoosh
Full-text search with Elasticsearch
Working with signals
Using caching with your application
E-mail support for Flask applications
Understanding asynchronous operations
Working with Celery
3. Module 3
1. Getting Started
Python package management with pip
Dependency sandboxing with virtualenv
The beginning of our project
Summary
2. Creating Models with SQLAlchemy
Our first model
CRUD
Relationships between models
The convenience of SQLAlchemy sessions
Database migrations with Alembic
Summary
3. Creating Views with Templates
Creating our views
Flask WTForms
Summary
4. Creating Controllers with Blueprints
Error pages
Class-based views
Blueprints
Summary
5. Advanced Application Structure
Application factories
Summary
6. Securing Your App
Using the session
Flask Login
Summary
7. Using NoSQL with Flask
RDBMS versus NoSQL
MongoDB in Flask
Leveraging the power of NoSQL
Summary
8. Building RESTful APIs
Setting up a RESTful Flask API
GET requests
POST requests
PUT requests
DELETE requests
Summary
9. Creating Asynchronous Tasks with Celery
Setting up Celery and RabbitMQ
Creating tasks in Celery
Running Celery tasks
Monitoring Celery
Creating a reminder app
Creating a weekly digest
Summary
10. Useful Flask Extensions
Flask Debug Toolbar
Flask Cache
Flask Assets
Flask Admin
Flask Mail
Summary
11. Building Your Own Extension
Modifying the response with Flask extensions
Summary
12. Testing Flask Apps
How does testing work?
Unit testing the application
User interface testing
Test coverage
Test-driven development
Summary
13. Deploying Flask Apps
Deploying on Heroku
Deploying on Amazon web services
Summary
Bibliography
Index
← Prev
Back
Next →
← Prev
Back
Next →