You are previewing web2py Application Development Cookbook.
O'Reilly logo
web2py Application Development Cookbook

Book Description

Over 110 recipes to master this full-stack Python web framework with this book.

  • Take your web2py skills to the next level by dipping into delicious, usable recipes in this cookbook

  • Learn advanced web2py usage from building advanced forms to creating PDF reports

  • Written by developers of the web2py project with plenty of code examples for interesting and comprehensive learning

In Detail

web2py is a free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications. It is written and programmable in Python, and straightforward to run. web2py implements Model-View-Controller design, server-side form validation, and postbacks that make the code more readable, scalable, and maintainable. Are you familiar with web2py, and interested in gaining more advanced knowledge?

web2py Application Development Cookbook gives you the necessary knowledge to make you a web2py expert. Right from teaching you about the database abstraction layer to adding AJAX effects to recipes about recipe, the book will make you a master of web2py through advanced practical recipes without any drudgery or straining the brain

web2py Application Development Cookbook is the tool you will need to expand and enhance your web2py skills.

This book begins with teaching you running web2py in various different systems followed by building simple applications. It focuses on database abstraction layer next and then explains building advanced forms. Adding stunning AJAX effects, using third party libraries and recipes on web services follow. Advanced recipes on authentication and authorization are taught and then routing and reporting recipes claim your attention. There is a final wrap-up with useful, interesting tips and tricks which you will really enjoy.

In short, this book will make you an expert in web2py in a trouble-free, quick, and easy manner.

Downloading the example code for this bookNew Book Structure ItemNew Book Structure ItemNew Book Structure Item

Table of Contents

  1. web2py Application Development Cookbook
  2. Credits
  3. About the Authors and Reviewers
  4. About the Reviewer
  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. Deploying web2py
    1. Introduction
    2. Installing web2py on Windows (from source code)
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    3. Installing web2py in Ubuntu
      1. Getting ready
      2. How to do it...
      3. There's more...
    4. Setting up a production deployment on Ubuntu
      1. Getting ready
      2. How to do it...
      3. There's more...
    5. Running web2py with Apache, mod_proxy, and mod_rewrite
      1. Getting ready
      2. How to do it...
    6. Running web2py with Lighttpd
      1. Getting ready
      2. How to do it...
    7. Running web2py with Cherokee
      1. How to do it...
      2. Getting ready
    8. Running web2py with Nginx and uWSGI
      1. Getting ready
      2. How to do it...
    9. Running web2py on shared hosts using CGI
      1. Getting ready
      2. How to do it...
    10. Running web2py on shared hosts with mod_proxy
      1. Getting ready
      2. How to do it...
    11. Running web2py from a user-defined folder
      1. How to do it...
      2. There's more...
      3. How to do it...
    12. Installing web2py as a service in Ubuntu
      1. There's more...
    13. Running web2py with IIS as a proxy
      1. Getting ready
      2. How to do it...
    14. Running web2py with ISAPI
      1. Getting ready
      2. How to do it...
      3. There's more...
  8. 2. Building Your First Application
    1. Introduction
    2. Improving the scaffolding application
      1. How to do it...
      2. There's more...
    3. Building a simple contacts application
      1. How to do it...
    4. Building a Reddit clone
      1. How to do it...
    5. Building a Facebook clone
      1. How to do it...
    6. Using crud.archive
      1. How to do it...
      2. There's more...
        1. Timestamping the stored record
        2. Storing the history of each record
    7. Converting an existing static site into a web2py application
      1. How to do it...
    8. Creating semi-static pages (flatpages)
      1. How to do it...
      2. How it works...
    9. Adding your custom logo
      1. How to do it...
    10. Creating menus and submenus
      1. How to do it...
    11. Customizing menus with icons
      1. How to do it...
    12. Creating a navigation bar
      1. How to do it...
    13. Using cookies to set the language
      1. How to do it...
    14. Designing modular applications
      1. Getting ready
      2. How to do it...
      3. How it works...
    15. Speeding up downloads
      1. How to do it...
        1. There's more...
  9. 3. Database Abstraction Layer
    1. Introduction
    2. Creating a new model
      1. Getting ready
      2. How to do it...
      3. There's more...
    3. Creating a model from a CSV file
      1. Getting ready
      2. How to do it...
      3. There's more...
    4. Batch upload of your data
      1. Getting ready
      2. How to do it...
      3. There's more...
    5. Moving your data from one database to another
      1. Getting ready
      2. How to do it...
        1. There's more...
    6. Creating a model from existing MySQL and PostgreSQL databases
      1. Getting ready
      2. How to do it...
      3. There's more...
    7. Efficiently searching by tag
      1. Getting ready
      2. How to do it...
      3. There's more...
    8. Accessing your database from multiple applications
      1. Getting ready
      2. How to do it...
      3. There's more...
    9. Hierarchical category tree
      1. How to do it...
    10. Creating records on demand
      1. How to do it...
    11. OR, LIKE, BELONGS, and more on Google App Engine
      1. Getting ready
      2. How to do it...
        1. Record insert
        2. Record update
        3. Joins
        4. Logical OR
        5. OR with orderby
        6. OR with more complex orderby
        7. LIKE
        8. date and datetime manipulations
    12. Replacing slow virtual fields with DB views
      1. How to do it...
      2. How it works...
      3. There's more...
  10. 4. Advanced Forms
    1. Introduction
      1. Adding a cancel button to forms
      2. Getting ready
      3. How to do it...
    2. Adding confirmation on form submit
      1. How to do it...
    3. Searching data dynamically
      1. How to do it...
    4. Embedding multiple forms in one page
      1. How to do it...
      2. There's more...
    5. Detecting and blocking concurrent updates
      1. Getting ready
      2. How to do it...
      3. There's more...
    6. Creating a form wizard
      1. How to do it...
        1. How it works...
    7. De-normalizing data temporarily
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    8. Removing form labels
      1. How to do it...
    9. Using fileuploader.js
      1. Getting ready
      2. How to do it...
    10. Uploading files using a LOADed component
      1. Getting ready
      2. How to do it...
    11. Making image thumbnails from uploaded images
      1. Getting ready
      2. How to do it...
    12. Monitoring upload progress
      1. How to do it...
        1. How it works...
    13. Auto tooltips in forms
      1. Getting ready
      2. How to do it...
    14. Color picker widget
      1. Getting ready
      2. How to do it...
    15. Shortening text fields
      1. How to do it...
        1. There's more...
    16. Creating multi-table forms
      1. Getting ready
      2. How to do it...
    17. Creating a multi-table form with references
      1. How to do it...
        1. There's more...
        2. How it works...
    18. Creating a multi-table update form
      1. How to do it...
      2. How it works...
      3. There's more...
    19. Star rating widget
      1. Getting ready
      2. How to do it...
  11. 5. Adding Ajax Effects
    1. Introduction
    2. Using jquery.multiselect.js
      1. Getting ready
      2. How to do it...
    3. Creating a select_or_add widget
      1. How to do it...
    4. Using an autocompletion plugin
      1. Getting ready
      2. How to do it...
        1. There is more...
    5. Creating a drop-down date selector
      1. How to do it...
    6. Improving the built-in ajax function
      1. How to do it...
    7. Using a slider to represent a number
      1. How to do it...
    8. Using jqGrid and web2py
      1. Getting ready
      2. How to do it...
    9. Improving data tables with WebGrid
      1. Getting ready
      2. How to do it...
    10. Ajaxing your search functions
      1. How to do it...
    11. Creating sparklines
      1. How to do it...
  12. 6. Using Third-party Libraries
    1. Introduction
    2. Customizing logging
      1. How to do it...
      2. There's more...
    3. Aggregating feeds
      1. How to do it...
      2. There's more...
    4. Displaying Tweets
      1. How to do it...
        1. There's more...
    5. Plotting with matplotlib
      1. How to do it...
      2. How it works...
      3. There's more...
    6. Extending PluginWiki with an RSS widget
      1. How to do it...
        1. There's more...
  13. 7. Web Services
    1. Introduction
    2. Consuming a web2py JSON service with jQuery
      1. How to do it...
      2. How it works...
      3. There's more...
    3. Consuming a JSON-RPC service
      1. Getting ready
      2. How do do it...
        1. There's more...
    4. JSON-RPC from JavaScript
      1. Getting ready
      2. How to do it...
      3. There's more...
    5. Making amf3 RPC calls from Flex using pyamf
      1. Getting ready
      2. How to do it...
    6. PayPal integration in Web2py
      1. How to do it...
    7. PayPal web payments standard
      1. How to do it...
    8. Getting Flickr photos
      1. Getting ready
      2. How to do it...
    9. Sending e-mails with Boto through Amazon Web Services (AWS)
      1. Getting ready
      2. How to do it...
    10. Making GIS amps using mapscript
      1. Getting ready
      2. How to do it...
    11. Google groups and Google code feeds reader
      1. How to do it...
    12. Creating SOAP web services
      1. How to do it...
      2. There's more...
  14. 8. Authentication and Authorization
    1. Introduction
    2. Customizing Auth
      1. How to do it...
      2. How it works...
      3. There's more...
    3. Using CAPTCHA on login failure
      1. How to do it...
      2. There's more...
    4. Using pyGravatar to get avatars for user profile pages
    5. Multi-user and teacher modes
      1. How to do it...
      2. There's more...
    6. Authenticating with Facebook using OAuth 2.0
      1. Getting ready
      2. How to do it...
      3. There's more...
  15. 9. Routing Recipes
    1. Introduction
    2. Making cleaner URLs with routes.py
      1. Getting ready
      2. How to do it...
    3. Creating a simple router
      1. How to do it...
    4. Adding a URL prefix
      1. How to do it...
    5. Associating applications with domains
      1. How to do it...
    6. Omitting the application name
      1. How to do it...
    7. Removing application name and controllers from URLs
      1. How to do it...
      2. How it works...
    8. Replacing underscores with hyphens in URLs
      1. How to do it...
    9. Mapping favicons.ico and robots.txt
      1. How to do it...
    10. Using URLs to specify the language
      1. How to do it...
  16. 10. Reporting Recipes
    1. Introduction
    2. Creating PDF reports
      1. How to do it...
      2. How it works...
    3. Creating PDF listings
      1. How to do it...
    4. Creating pdf labels, badges, and invoices
      1. How to do it...
      2. How it works...
      3. There's more...
  17. 11. Other Tips and Tricks
    1. Introduction
    2. Using PDB and the embedded web2py debugger
      1. How to do it...
      2. How it works...
      3. There's more...
    3. Debugging with Eclipse and PyDev
      1. Getting ready
      2. There's more...
    4. Updating web2py using a shell script
      1. How to do it...
      2. There's more...
    5. Creating a simple page statistics plugin
      1. How to do it...
      2. How it works...
      3. There's more...
    6. Rounding corners without images or JavaScript
      1. Getting ready
      2. How to do it...
      3. There's more...
    7. Setting a cache.disk quota
      1. How to do it...
    8. Checking if web2py is running using cron
      1. How to do it...
    9. Building a Mercurial plugin
      1. Getting ready
      2. How to do it...
    10. Building a pingback plugin
      1. How to do it...
      2. How it works...
    11. Changing views for mobile browsers
      1. Getting ready
      2. How to do it...
    12. Background processing with a database queue
      1. How to do it...
      2. There's more...
    13. How to effectively use template blocks
      1. How to do it...
      2. There's more...
    14. Making standalone applications with web2py and wxPython
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...