Chapter 9. Routing Recipes
In this chapter, we will cover the following recipes:
Making cleaner URLs with
routes.py
Creating a simple router
Adding a URL prefix
Associating applications with domains
Omitting the application name
Removing application names and controllers from URLs
Replacing underscores with hyphens in URLs
Mapping
favicons.ico
androbots.txt
Using URLs to specify the language
Introduction
At its core, web2py contains a dispatcher that maps URLs into function calls. This mapping is called routing, and it can be configured. This may be necessary in order to shorten URLs, or to deploy a web2py application as a replacement for a pre-existing application, by not wanting to break old external links. web2py comes with two routers, that is, a ...
Get web2py Application Development Cookbook now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.