forked from coto/gae-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.py
36 lines (31 loc) · 1.92 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
"""
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
from web import handlers
import config
secure_scheme = 'https'
_routes = [
RedirectRoute('/taskqueue-send-email/', handlers.SendEmailHandler, name='send-reset-email', strict_slash=True),
RedirectRoute('/login/', handlers.LoginHandler, name='login', strict_slash=True),
RedirectRoute('/logout/', handlers.LogoutHandler, name='logout', strict_slash=True),
RedirectRoute('/register/', handlers.RegisterHandler, name='register', strict_slash=True),
RedirectRoute('/contact/', handlers.ContactHandler, name='contact', strict_slash=True),
RedirectRoute('/settings/profile', handlers.EditProfileHandler, name='edit-profile', strict_slash=True),
RedirectRoute('/settings/password', handlers.EditPasswordHandler, name='edit-password', strict_slash=True),
RedirectRoute('/settings/email', handlers.EditEmailHandler, name='edit-email', strict_slash=True),
RedirectRoute('/password-reset/', handlers.PasswordResetHandler, name='password-reset', strict_slash=True),
RedirectRoute('/password-reset/<user_id>/<token>', handlers.PasswordResetCompleteHandler, name='password-reset-check', strict_slash=True),
RedirectRoute('/change-email/<user_id>/<encoded_email>/<token>', handlers.EmailChangedCompleteHandler, name='email-changed-check', strict_slash=True),
RedirectRoute('/secure/', handlers.SecureRequestHandler, name='secure', strict_slash=True),
RedirectRoute('/', handlers.HomeRequestHandler, name='home', 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)