You are previewing Instant Flask Web Development.
O'Reilly logo
Instant Flask Web Development

Book Description

Impatient for results? This is a fast, concise guide to the essentials of Flask with a totally practical approach that means you’ll be up and running on your first Flask app before you know it.

  • Learn something new in an Instant! A short, fast, focused guide delivering immediate results

  • Build a small but complete web application with Python and Flask

  • 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

  • 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.

    Table of Contents

    1. Instant Flask Web Development
      1. Instant Flask Web Development
      2. Credits
      3. About the Author
      4. About the Reviewers
      5. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      7. 1. Instant Flask Web Development
        1. Preparing for development (Simple)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Checklist for the development environment
            2. Common errors and how to solve them
        2. Running a simple application (Simple)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Project layout
            2. Development server
            3. Command-line interface with Flask-Script
        3. Routing URLs and accepting requests (Simple)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Handling HTTP methods
            2. An alternative to decorating functions
            3. Route collisions
            4. Routing with subdomains
        4. Handling requests and responses (Simple)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Before and after a request
        5. Handling static files (Simple)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Serving static files in production
            2. Hosting static files elsewhere
            3. Custom static file handler
            4. HTTP caching
            5. Directory index
        6. Using a database (Simple)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Querying with SQLAlchemy
            2. Production database
            3. Naming conventions
            4. Custom SQL
            5. Document stores and non-relational databases
        7. Handling forms and file uploads (Simple)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Handling file uploads
        8. Templating with Jinja – setting a base template (Simple)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Using a template engine other than Jinja
            2. Manage web packages with Bower
        9. Creating a new record (Intermediate)
          1. Getting ready
          2. How to do it...
          3. How it works...
        10. Displaying a record (Intermediate)
          1. Getting ready
          2. How to do it...
          3. How it works...
        11. Editing a record (Intermediate)
          1. Getting ready
          2. How to do it...
          3. How it works...
        12. Listing all records (Simple)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Database identifiers
        13. Deleting a record (Advanced)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Ajax
        14. Using custom template filters in Jinja (Advanced)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Additional filters
        15. Sending error responses (Simple)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Handling specific exceptions
            2. Flask's debugger
        16. Authenticating users (Advanced)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Appointment relationship
            2. Opening a session
            3. Database migration
            4. Authenticating with existing services
        17. Handling sessions and users (Intermediate)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Flashing messages
            2. Cross-site request forgery protection
        18. Deploying to the world (Advanced)
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Handling static files with nginx
            2. Deployable on any OS with HTTP proxying
            3. Windows server deployment
            4. Other deployment options