File: complex_routing.py

package info (click to toggle)
python-werkzeug 0.9.6%2Bdfsg-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 3,120 kB
  • ctags: 3,018
  • sloc: python: 17,930; makefile: 149; pascal: 60; xml: 16
file content (19 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from werkzeug.routing import Map, Rule, Subdomain, Submount, EndpointPrefix

m = Map([
    # Static URLs
    EndpointPrefix('static/', [
        Rule('/', endpoint='index'),
        Rule('/about', endpoint='about'),
        Rule('/help', endpoint='help'),
    ]),
    # Knowledge Base
    Subdomain('kb', [EndpointPrefix('kb/', [
        Rule('/', endpoint='index'),
        Submount('/browse', [
            Rule('/', endpoint='browse'),
            Rule('/<int:id>/', defaults={'page': 1}, endpoint='browse'),
            Rule('/<int:id>/<int:page>', endpoint='browse')
        ])
    ])])
])