forked from kernel1983/pythonic.info
-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.py
executable file
·60 lines (47 loc) · 1.76 KB
/
web.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
import sys
import os
import logging
import cgi
#import wsgiref.simple_server
#import wsgiref.handlers
#import tornado.wsgi
import tornado.options
import tornado.ioloop
import tornado.web
import tornado.template
import tornado.database
import tornado.auth
from setting import settings
from setting import conn
from controller import main
from controller import api
from controller import auth
handlers = [
(r"/", main.FeedHandler),
(r"/item", main.ItemHandler),
(r"/signup", main.SignupHandler),
(r"/login", main.LoginHandler),
(r"/logout", main.LogoutHandler),
(r"/api/login", api.LoginAPIHandler),
(r"/api/signup", api.SignupAPIHandler),
(r"/api/user_info", api.UserInfoAPIHandler),
(r"/api/get_news_feed", api.NewsFeedAPIHandler),
(r"/api/get_news_item", api.NewsItemAPIHandler),
(r"/api/profile_img", api.ProfileImgAPIHandler),
(r"/api/like", api.LikeAPIHandler),
(r"/api/unlike", api.UnlikeAPIHandler),
(r"/api/follow", api.FollowAPIHandler),
(r"/api/unfollow", api.UnfollowAPIHandler),
(r"/api/post_status", api.PostStatusAPIHandler),
(r"/api/post_comment", api.PostCommentAPIHandler),
(r"/auth/google", auth.GoogleHandler),
(r"/auth/logout", auth.LogoutHandler),
#(r"/()", tornado.web.StaticFileHandler, dict(path=settings['static_path']+'/index.html')),
#(r"/(.*)", tornado.web.StaticFileHandler, dict(path=settings['static_path'], default_filename='index.html')),
]
if __name__ == "__main__":
tornado.options.define("port", default=8000, help="Run server on a specific port", type=int)
tornado.options.parse_command_line()
application = tornado.web.Application(handlers, **settings)
application.listen(tornado.options.options.port)
tornado.ioloop.IOLoop.instance().start()