web2py Application Development Cookbook

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

web2py Application Development Cookbook

Cookbook
Mariano Reingart et al.

Over 110 recipes to master this full-stack Python web framework with this book and ebook
$29.99
$49.99
RRP $29.99
RRP $49.99
eBook
Print + eBook
$12.99 p/month

Want this title & more? Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.
+ Collection
Free Sample

Book Details

ISBN 139781849515467
Paperback364 pages

About 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  

Who This Book Is For

The target audience are Python developers with basic knowledge of web2py who want to gain further knowledge of web2py.

Table of Contents

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

What You Will Learn

Install web2py on windows from source code and run it on Apache, Lighttpd, and Nginx servers Build simple applications such as a contacts applications and a facebook clone Create a new model and batch upload your data Embed multiple forms in one page and create multi-table forms Improve the built-in AJAX function and AJAXify your search functions Generate PDF reports and charts Consume JSON service and integrate Paypal with web2py Debug with eclipse and PyDev, learn to build your own plugin  

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.

Authors

Table of Contents

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

Book Details

ISBN 139781849515467
Paperback364 pages
Read More