Flask By Example

Unleash the full potential of the Flask web framework by creating simple yet powerful web applications

Flask By Example

This ebook is included in a Mapt subscription
Gareth Dwyer

1 customer reviews
Unleash the full potential of the Flask web framework by creating simple yet powerful web applications
$27.99
$34.99
RRP $27.99
RRP $34.99
eBook
Print + eBook
Subscribe and access every Packt eBook & Video.
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781785286933
Paperback276 pages

Book Description

This book will take you on a journey from learning about web development using Flask to building fully functional web applications. In the first major project, we develop a dynamic Headlines application that displays the latest news headlines along with up-to-date currency and weather information. In project two, we build a Crime Map application that is backed by a MySQL database, allowing users to submit information on and the location of crimes in order to plot danger zones and other crime trends within an area. In the final project, we combine Flask with more modern technologies, such as Twitter's Bootstrap and the NoSQL database MongoDB, to create a Waiter Caller application that allows restaurant patrons to easily call a waiter to their table. This pragmatic tutorial will keep you engaged as you learn the crux of Flask by working on challenging real-world applications.

Table of Contents

Chapter 1: Hello, World!
Introducing Flask
Creating our development environment
Writing "Hello, World!"
Deploying our application to production
Summary
Chapter 2: Getting Started with Our Headlines Project
Setting up our project and a Git repository
Creating a new Flask application
Introduction to RSS and RSS feeds
Summary
Chapter 3: Using Templates in Our Headlines Project
Introducing Jinja
Basic use of Jinja templates
Advanced use of Jinja templates
Summary
Chapter 4: User Input for Our Headlines Project
Getting user input using HTTP GET
Getting user input using HTTP POST
Adding weather and currency data
Summary
Chapter 5: Improving the User Experience of Our Headlines Project
Adding cookies to our Headlines application
Adding CSS to our Headlines application
Summary
Chapter 6: Building an Interactive Crime Map
Setting up a new Git repository
Understanding relational databases
Installing and configuring MySQL on our VPS
Creating our Crime Map database in MySQL
Creating a basic database web application
Summary
Chapter 7: Adding Google Maps to Our Crime Map Project
Running a database application locally
Adding an embedded Google Maps widget to our application
Adding an input form for new crimes
Displaying existing crimes on our map
Summary
Chapter 8: Validating User Input in Our Crime Map Project
Choosing where to validate
Trying out an XSS example
Validating and sanitizing
Summary
Chapter 9: Building a Waiter Caller App
Setting up a new Git repository
Using Bootstrap to kick-start our application
Adding user account control to our application
Summary
Chapter 10: Template Inheritance and WTForms in Waiter Caller Project
Adding the Account and Dashboard pages
Shortening URLs using the bitly API
Adding functionality to handle attention requests
Adding user feedback with WTForms
Summary
Chapter 11: Using MongoDB with Our Waiter Caller Project
Introducing MongoDB
Installing MongoDB
Using the MongoDB shell
Introducing PyMongo
Testing our application in production
Adding some finishing touches
Summary

What You Will Learn

  • Build three web applications from the ground up using the powerful Python micro framework, Flask.
  • Dynamically display data to your viewers, based on their requests
  • Store user and static data in SQL and NoSQL databases and use this data to power your web applications
  • Create a good user experience by combining HTML, CSS, and JavaScript
  • Harness the convenience of freely available APIs, including OpenWeatherMap, Open Exchange Rates, and bitly
  • Extend your applications to build advanced functionality, such as a user account control system using Flask-Login
  • Learn about web application security and defend against common attacks, such as SQL injection and XSS

Authors

Table of Contents

Chapter 1: Hello, World!
Introducing Flask
Creating our development environment
Writing "Hello, World!"
Deploying our application to production
Summary
Chapter 2: Getting Started with Our Headlines Project
Setting up our project and a Git repository
Creating a new Flask application
Introduction to RSS and RSS feeds
Summary
Chapter 3: Using Templates in Our Headlines Project
Introducing Jinja
Basic use of Jinja templates
Advanced use of Jinja templates
Summary
Chapter 4: User Input for Our Headlines Project
Getting user input using HTTP GET
Getting user input using HTTP POST
Adding weather and currency data
Summary
Chapter 5: Improving the User Experience of Our Headlines Project
Adding cookies to our Headlines application
Adding CSS to our Headlines application
Summary
Chapter 6: Building an Interactive Crime Map
Setting up a new Git repository
Understanding relational databases
Installing and configuring MySQL on our VPS
Creating our Crime Map database in MySQL
Creating a basic database web application
Summary
Chapter 7: Adding Google Maps to Our Crime Map Project
Running a database application locally
Adding an embedded Google Maps widget to our application
Adding an input form for new crimes
Displaying existing crimes on our map
Summary
Chapter 8: Validating User Input in Our Crime Map Project
Choosing where to validate
Trying out an XSS example
Validating and sanitizing
Summary
Chapter 9: Building a Waiter Caller App
Setting up a new Git repository
Using Bootstrap to kick-start our application
Adding user account control to our application
Summary
Chapter 10: Template Inheritance and WTForms in Waiter Caller Project
Adding the Account and Dashboard pages
Shortening URLs using the bitly API
Adding functionality to handle attention requests
Adding user feedback with WTForms
Summary
Chapter 11: Using MongoDB with Our Waiter Caller Project
Introducing MongoDB
Installing MongoDB
Using the MongoDB shell
Introducing PyMongo
Testing our application in production
Adding some finishing touches
Summary

Book Details

ISBN 139781785286933
Paperback276 pages
Read More
From 1 reviews

Read More Reviews