-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
63 lines (56 loc) · 2.06 KB
/
main.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
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# General
from webapp2 import WSGIApplication
from google.appengine.ext import db
from helpers import *
# Models
from models.user import User
from models.post import Post
from models.like import Like
from models.comment import Comment
# Handlers
from handlers.blog import BlogHandler
from handlers.blogfront import BlogFrontHandler
from handlers.signup import SignupHandler
from handlers.login import LoginHandler
from handlers.logout import LogoutHandler
from handlers.post import PostHandler
from handlers.newpost import NewPostHandler
from handlers.editpost import EditPostHandler
from handlers.deletepost import DeletePostHandler
from handlers.likepost import LikePostHandler
from handlers.unlikepost import UnlikePostHandler
from handlers.addcomment import AddCommentHandler
from handlers.editcomment import EditCommentHandler
from handlers.deletecomment import DeleteCommentHandler
# Routing
app = WSGIApplication([
('/', BlogFrontHandler),
('/signup', SignupHandler),
('/login', LoginHandler),
('/logout', LogoutHandler),
('/newpost', NewPostHandler),
('/([0-9]+)', PostHandler),
('/([0-9]+)/like', LikePostHandler),
('/([0-9]+)/unlike', UnlikePostHandler),
('/([0-9]+)/edit', EditPostHandler),
('/([0-9]+)/delete/([0-9]+)', DeletePostHandler),
('/([0-9]+)/addcomment/([0-9]+)', AddCommentHandler),
('/([0-9]+)/([0-9]+)/editcomment/([0-9]+)', EditCommentHandler),
('/([0-9]+)/([0-9]+)/deletecomment/([0-9]+)', DeleteCommentHandler)
], debug=True)