Op werkdagen voor 23:00 besteld, morgen in huis Gratis verzending vanaf €20

Flask Web Development

Developing Web Applications with Python

Paperback Engels 2018 2e druk 9781491991732
Verwachte levertijd ongeveer 16 werkdagen

Samenvatting

Take full creative control of your web applications with Flask, the Python-based microframework. With the second edition of this hands-on book, you’ll learn the framework from the ground up by developing, step-by-step, a real-world project created by author Miguel Grinberg. This refreshed edition accounts for important technology changes that have occurred in the past three years.

You’ll learn the framework’s core functionality, as well as how to extend applications with advanced web techniques such as database migration and web service communication. The first part of each chapter provides you with reference and background for the topic in question, while the second part guides you though a hands-on implementation of the topic.

If you have Python experience, this book shows you how to take advantage of the creative freedom Flask provides.

Specificaties

ISBN13:9781491991732
Taal:Engels
Bindwijze:paperback
Aantal pagina's:291
Uitgever:O'Reilly
Druk:2
Verschijningsdatum:29-3-2018
Hoofdrubriek:IT-management / ICT

Lezersrecensies

Wees de eerste die een lezersrecensie schrijft!

Over Miguel Grinberg

Miquel Grinberg has over 25 years of experience as a software engineer. He blogs about a variety of topics including web development, Python, robotics, photography, and the occasional movie review.

Andere boeken door Miguel Grinberg

Inhoudsopgave

Preface
Who This Book Is For
How This Book Is Organized
How to Work with the Example Code
Using Code Examples
Conventions Used in This Book
O’Reilly Safari
How to Contact Us
Acknowledgments
Additional Thanks for the Second Edition

I: Introduction to Flask
1. Installation
Creating the Application Directory
Virtual Environments
Creating a Virtual Environment with Python 3
Creating a Virtual Environment with Python 2
Working with a Virtual Environment
Installing Python Packages with pip

2. Basic Application Structure
Initialization
Routes and View Functions
A Complete Application
Development Web Server
Dynamic Routes
Debug Mode
Command-Line Options
The Request-Response Cycle
Application and Request Contexts
Request Dispatching
The Request Object
Request Hooks
Responses
Flask Extensions

3. Templates
The Jinja2 Template Engine
Rendering Templates
Variables
Control Structures
Bootstrap Integration with Flask-Bootstrap
Custom Error Pages
Links
Static Files
Localization of Dates and Times with Flask-Moment

4. Web Forms
Configuration
Form Classes
HTML Rendering of Forms
Form Handling in View Functions
Redirects and User Sessions
Message Flashing

5. Databases
SQL Databases
NoSQL Databases
SQL or NoSQL?
Python Database Frameworks
Database Management with Flask-SQLAlchemy
Model Definition
Relationships
Database Operations
Creating the Tables
Inserting Rows
Modifying Rows
Deleting Rows
Querying Rows
Database Use in View Functions
Integration with the Python Shell
Database Migrations with Flask-Migrate
Creating a Migration Repository
Creating a Migration Script
Upgrading the Database
Adding More Migrations

6. Email
Email Support with Flask-Mail
Sending Email from the Python Shell
Integrating Emails with the Application
Sending Asynchronous Email

7. Large Application Structure
Project Structure
Configuration Options
Application Package
Using an Application Factory
Implementing Application Functionality in a Blueprint
Application Script
Requirements File
Unit Tests
Database Setup
Running the Application

II: Example: A Social Blogging Application
8. User Authentication
Authentication Extensions for Flask
Password Security
Hashing Passwords with Werkzeug
Creating an Authentication Blueprint
User Authentication with Flask-Login
Preparing the User Model for Logins
Protecting Routes
Adding a Login Form
Signing Users In
Signing Users Out
Understanding How Flask-Login Works
Testing Logins
New User Registration
Adding a User Registration Form
Registering New Users
Account Confirmation
Generating Confirmation Tokens with itsdangerous
Sending Confirmation Emails
Account Management

9. User Roles
Database Representation of Roles
Role Assignment
Role Verification

10. User Profiles
Profile Information
User Profile Page
Profile Editor
User-Level Profile Editor
Administrator-Level Profile Editor
User Avatars

11. Blog Posts
Blog Post Submission and Display
Blog Posts on Profile Pages
Paginating Long Blog Post Lists
Creating Fake Blog Post Data
Rendering in Pages
Adding a Pagination Widget
Rich-Text Posts with Markdown and Flask-PageDown
Using Flask-PageDown
Handling Rich Text on the Server
Permanent Links to Blog Posts
Blog Post Editor

12. Followers
Database Relationships Revisited
Many-to-Many Relationships
Self-Referential Relationships
Advanced Many-to-Many Relationships
Followers on the Profile Page
Querying Followed Posts Using a Database Join
Showing Followed Posts on the Home Page

13. User Comments
Database Representation of Comments
Comment Submission and Display
Comment Moderation

14. Application Programming Interfaces
Introduction to REST
Resources Are Everything
Request Methods
Request and Response Bodies
Versioning
RESTful Web Services with Flask
Creating an API Blueprint
Error Handling
User Authentication with Flask-HTTPAuth
Token-Based Authentication
Serializing Resources to and from JSON
Implementing Resource Endpoints
Pagination of Large Resource Collections
Testing Web Services with HTTPie

III: The Last Mile
15. Testing
Obtaining Code Coverage Reports
The Flask Test Client
Testing Web Applications
Testing Web Services
End-to-End Testing with Selenium
Is It Worth It?

16. Performance
Logging Slow Database Performance
Source Code Profiling

17. Deployment
Deployment Workflow
Logging of Errors During Production
Cloud Deployment
The Heroku Platform
Preparing the Application
Testing with Heroku Local
Deploying with git push
Deploying an Upgrade
Docker Containers
Installing Docker
Building a Container Image
Running a Container
Inspecting a Running Container
Pushing Your Container Image to an External Registry
Using an External Database
Container Orchestration with Docker Compose
Cleaning Up Old Containers and Images
Using Docker in Production
Traditional Deployments
Server Setup
Importing Environment Variables
Setting Up Logging

18. Additional Resources
Using an Integrated Development Environment (IDE)
Finding Flask Extensions
Getting Help
Getting Involved with Flask

Index

Managementboek Top 100

Rubrieken

Populaire producten

    Personen

      Trefwoorden

        Flask Web Development