Book Image

web2py Application Development Cookbook

By : Mariano Reingart, Bruno Cezar Rocha, Jonathan Lundell, Pablo Martin Mulone, Michele Comitini, Richard Gordon, Massimo Di Pierro
Book Image

web2py Application Development Cookbook

By: Mariano Reingart, Bruno Cezar Rocha, Jonathan Lundell, Pablo Martin Mulone, Michele Comitini, Richard Gordon, Massimo Di Pierro

Overview of this book

<p><undefined:p>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?<undefined:br><undefined:br><undefined:i>web2py Application Development Cookbook</undefined:i> 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.<undefined:br><undefined:br><undefined:i>web2py Application Development Cookbook</undefined:i> is the tool you will need to expand and enhance your web2py skills.<undefined:br><undefined:br>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.<undefined:br><undefined:br>In short, this book will make you an expert in web2py in a trouble-free, quick, and easy manner.</undefined:br></undefined:br></undefined:br></undefined:br></undefined:br></undefined:br></undefined:br></undefined:br></undefined:p></p>
Table of Contents (18 chapters)
web2py Application Development Cookbook
Credits
About the Authors and Reviewers
About the Reviewer
www.PacktPub.com
Preface
Index

Creating a simple router


This and the next recipes in this chapter deal with the new parameter-based router, which is generally easier to configure, and handles most common re-writing tasks effectively. If possible, try to use the parameter-based router, but if you need more control for special URL-rewriting tasks, look at the pattern-based router.

The starting point for using the parameter-based router is to copy the file router.example.py to routes.py, in the web2py base directory. (The file routes.example.py serves the same purpose for the pattern-based router.) The example file contains basic documentation for its respective routing systems; additional documentation is available online in the web2py book, Chapter 4, The Core: URL rewrite and Routes on error..

Whenever routes.py is changed, you must either restart web2py or, if the admin app is available, load the following URL, for the new configuration to take effect:

http://yourdomain.com/admin/default/reload_routes

Tip

The example routing...