aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/server.py12
-rw-r--r--app/urls.py25
2 files changed, 28 insertions, 9 deletions
diff --git a/app/server.py b/app/server.py
index 22238fa..387fa62 100644
--- a/app/server.py
+++ b/app/server.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
# Copyright (C) 2014 Linaro Ltd.
#
# This program is free software: you can redistribute it and/or modify
@@ -18,19 +17,14 @@ import pymongo
import tornado.ioloop
import tornado.web
-from handlers import (
- DefConfHandler,
- JobHandler
-)
+from urls import app_urls
if __name__ == '__main__':
client = pymongo.MongoClient()
application = tornado.web.Application(
- [
- (r'/api/job', JobHandler),
- (r'/api/defconfig', DefConfHandler)
- ], client=client,
+ app_urls,
+ client=client,
)
application.listen(8888)
diff --git a/app/urls.py b/app/urls.py
index e69de29..112bb07 100644
--- a/app/urls.py
+++ b/app/urls.py
@@ -0,0 +1,25 @@
+# Copyright (C) 2014 Linaro Ltd.
+#
+# 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/>.
+
+
+from handlers import (
+ DefConfHandler,
+ JobHandler,
+)
+
+app_urls = [
+ (r'/api/defconfig(?P<sl>/)?(?P<id>.*)', DefConfHandler),
+ (r'/api/job(?P<sl>/)?(?P<id>.*)', JobHandler),
+]