summaryrefslogtreecommitdiff
path: root/docs/index.rst
blob: 7e9cc7aeac10608d129a39f6d353c8591092834b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
====================
Routes Documentation
====================

.. image:: routes-logo.png
    :width: 100px
    :height: 171px
    :align: left

Routes is a Python re-implementation of the Rails routes system for mapping URLs to application actions, and conversely to generate URLs. Routes makes it easy to create pretty and concise URLs that are RESTful with little effort.

Routes allows conditional matching based on domain, cookies, HTTP method, or a custom function. Sub-domain support is built in. Routes comes with an extensive unit test suite.

Current features:

* Sophisticated route lookup and URL generation
* Named routes
* Redirect routes
* Wildcard paths before and after static parts
* Sub-domain support built-in
* Conditional matching based on domain, cookies, HTTP method (RESTful), and more
* Easily extensible utilizing custom condition functions and route generation
  functions
* Extensive unit tests

Installing
==========

Routes can be easily installed with pip or easy_install::
   
   $ easy_install routes

Example
=======

.. code-block:: python
   
   # Setup a mapper
   from routes import Mapper
   map = Mapper()
   map.connect(None, "/error/{action}/{id}, controller="error")
   map.connect("home", "/", controller="main", action="index")

   # Match a URL, returns a dict or None if no match
   result = map.match('/error/myapp/4')
   # result == {'controller': 'main', 'action': 'myapp', 'id': '4'}

Source
======

The `routes source can be found on GitHub <http://github.com/bbangert/routes>`_.

.. toctree::
   :maxdepth: 2
   
   introduction
   setting_up
   generating
   restful
   uni_redirect_rest
   changes

.. toctree::
   :maxdepth: 1

   glossary
   porting
   

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`glossary`

Module Listing
--------------

.. toctree::
    :maxdepth: 2

    modules/index