-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.py
58 lines (53 loc) · 1.56 KB
/
routes.py
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
"""
Using redirect route instead of simple routes since it supports strict_slash
Simple route: http://webapp-improved.appspot.com/guide/routing.html#simple-routes
RedirectRoute: http://webapp-improved.appspot.com/api/webapp2_extras/routes.html#webapp2_extras.routes.RedirectRoute
"""
from webapp2_extras.routes import RedirectRoute
import handlers
secure_scheme = 'https'
_routes = [
RedirectRoute('/',
handlers.MainHandler,
name='home',
strict_slash=True),
RedirectRoute('/about',
handlers.AboutHandler,
name='about',
strict_slash=True),
RedirectRoute('/about/<club>',
handlers.AboutHandler,
name='about-club',
strict_slash=True),
RedirectRoute('/recipes',
handlers.RecipeHandler,
name='recipes',
strict_slash=True),
RedirectRoute('/recipes/<style>',
handlers.RecipeHandler,
name='recipe-style',
strict_slash=True),
RedirectRoute('/recipes/<style>/<name>',
handlers.RecipeHandler,
name='recipe-style-name',
strict_slash=True),
RedirectRoute('/news',
handlers.NewsHandler,
name='news',
strict_slash=True),
RedirectRoute('/events',
handlers.EventsHandler,
name='events',
strict_slash=True),
RedirectRoute('/resources',
handlers.ResourcesHandler,
name='resources',
strict_slash=True),
]
def get_routes():
return _routes
def add_routes(app):
if app.debug:
secure_scheme = 'http'
for r in _routes:
app.router.add(r)