About This Book

Explore the basics of web page layout using Twitter Bootstrap and jQuery

Get to know how to validate data entry using HTML forms and WTForms

Understand SQLAlchemy and relational databases

Who This Book Is For

Instant Flask Web Development is for developers who are new to web programming, or are familiar with web programming but new to Flask. This book gives you a head start if you have some beginner experience with Python and HTML, or are willing to learn.

Table of Contents

Chapter 1: Instant Flask Web Development

Preparing for development (Simple)

Running a simple application (Simple)

Routing URLs and accepting requests (Simple)

Handling requests and responses (Simple)

Handling static files (Simple)

Using a database (Simple)

Handling forms and file uploads (Simple)

Templating with Jinja – setting a base template (Simple)

Creating a new record (Intermediate)

Displaying a record (Intermediate)

Editing a record (Intermediate)

Listing all records (Simple)

Deleting a record (Advanced)

Using custom template filters in Jinja (Advanced)

Sending error responses (Simple)

Authenticating users (Advanced)

Handling sessions and users (Intermediate)

Deploying to the world (Advanced)

What You Will Learn

Manage your project dependencies using virtualenv

Understand how Flask provides URL routing and web request handling

Recognize how Flask serves static files on disk

Learn about modeling, storing, and querying data with SQLAlchemy

Present HTML forms and validate input with WTForms

Build a page layout with Twitter Bootstrap using a base Jinja template

Create, recall, update, delete, and list database records

Build custom template filters in Jinja to format data

Authenticate users and maintain sessions

In Detail

Flask is a web framework for Python, which lets you start simply and grow carefully without facing any issues with the framework as your project gets large. Flask integrates Werkzeug (a web programming toolkit) and Jinja (a templating engine) and adds a layer that lets you build web applications and services in a compact way, while letting you choose your own tools.

Instant Flask Web Development takes you beyond the quick start in the Flask documentation and shows you a bottom-up approach to organizing your Flask application. It shows you how to build a small deployable scheduling application with pointers to the various design decisions you can make when developing with Flask.

Instant Flask Web Development lets you set up your development environment and learn how Flask handles web requests, then shows you how to build a functional data-driven web application that is ready to publish, by adding one layer at a time. When working with Flask, you can work with Python and utilize its best tools for the job. The book will help you build the layers of a simple application: URL routes with Flask, a database with SQLAlchemy, form validation with WTForms, user authentication and sessions, page layout with Twitter Bootstrap, and browser code with jQuery.

This book promises to get you up and running on your first Flask app, so that you can use Flask and Python on your next web project.

Authors

Ron DuPlain

Ron DuPlain is a core contributor to the Flask project, and has built dozens of production applications with Flask. He has been thinking in Python since 2005, applying it to a variety of applications from embedded systems to web development. He is based in Charlottesville, Virginia, USA, where he runs the local Python meetup group and is an organizer of the local bar camp unconferences. He holds a Bachelors in Science in Computer engineering from the University of Cincinnati and a Masters in Systems engineering from the University of Virginia.

Alerts & Offers

Series & Level

We understand your time is important. Uniquely amongst the major publishers, we seek to develop and publish the broadest range of learning and information products on each technology. Every Packt product delivers a specific learning pathway, broadly defined by the Series type. This structured approach enables you to select the pathway which best suits your knowledge level, learning style and task objectives.

Learning

As a new user, these step-by-step tutorial guides will give you all the practical skills necessary to become competent and efficient.

Beginner's Guide

Friendly, informal tutorials that provide a practical introduction using examples, activities, and challenges.

Essentials

Fast paced, concentrated introductions showing the quickest way to put the tool to work in the real world.

Cookbook

A collection of practical self-contained recipes that all users of the technology will find useful for building more powerful and reliable systems.

Blueprints

Guides you through the most common types of project you'll encounter, giving you end-to-end guidance on how to build your specific solution quickly and reliably.

Mastering

Take your skills to the next level with advanced tutorials that will give you confidence to master the tool's most powerful features.

Starting

Accessible to readers adopting the topic, these titles get you into the tool or technology so that you can become an effective user.

Progressing

Building on core skills you already have, these titles share solutions and expertise so you become a highly productive power user.