-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.py
105 lines (95 loc) · 2.86 KB
/
index.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# index.py:
##
# © 2012 Steven Casagrande ([email protected]) and
# Christopher E. Granade ([email protected]).
# This file is a part of the ThingPool Server project.
# Licensed under the AGPL version 3.
##
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##
## IMPORTS #####################################################################
## GAE API ##
from google.appengine.api import users
## WEB FRAMEWORK
import webapp2
import jinja2
## PYTHON STANDARD LIBRARY ##
import os
## THINGPOOL MODULES ##
import api
import config
import main_site
import admin_console
## CORE SERVER #################################################################
routes = [
# Mobile site routes
webapp2.Route('/',
handler=main_site.MainPage,
name='main'),
# Admin console
webapp2.Route('/admin',
handler=admin_console.MainPage,
name='admin_main'),
# API routes
webapp2.Route('/api/info',
handler=api.ServerInfoHandler,
name='api_server_info'
),
webapp2.Route('/api/users',
handler=api.UserListHandler,
name='api_users_list'
),
webapp2.Route('/api/users/<user_id>',
handler=api.UserHandler,
name='api_user'
),
webapp2.Route('/api/items',
handler=api.ItemListHandler,
name='api_item_list'
),
webapp2.Route('/api/items/<item_id>',
handler=api.ItemHandler,
name='api_item'
),
webapp2.Route('/api/categories',
handler=api.CategoryListHandler,
name='api_categories_list'
),
webapp2.Route('/api/categories/<category_id>',
handler=api.CategoryHandler,
name='api_category'
),
webapp2.Route('/api/checkout',
handler=api.CheckoutListHandler,
name='api_checkout_list'
),
webapp2.Route('/api/checkout/<checkout_id>',
handler=api.CheckoutHandler,
name='api_checkout'
),
webapp2.Route('/api/request',
handler=api.RequestListHandler,
name='api_request_list'
),
webapp2.Route('/api/request/<request_id>',
handler=api.RequestHandler,
name='api_request'
),
]
app = webapp2.WSGIApplication(
routes=routes,
debug=True)