forked from youngbetter/Shacus_app_V2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
95 lines (90 loc) · 4.05 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
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
# -*- coding: utf-8 -*-
'''
@author: 黄鑫晨lala
'''
#!/usr/bin/env python
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from sqlalchemy.orm import scoped_session, sessionmaker
from tornado.options import define, options
from Activity.ACHandler import ActivityCreate, ActivityRegister
from Activity.ACaskHandler import AskActivity
from Activity.ACentryHandler import AskEntry
from Appointment.APAskHandler import APaskHandler
from Appointment.APCreateHandler_new import APcreateHandler
from Appointment.APRegistHandler import APregistHandler
from Appointment.APchatCreateHandler import APchatCreateHandler
from Appointment.APpraseHandler import APprase
from Appointment.ApCompanionAuthHandler import AcAuthHandler
from Appointment.ApCompanionHandler import ApCompanionHandler
from Appointment.Ranklist import Ranklist
from Database.models import engine
from ImageCallback import ImageCallback
from Message.Sysmessage import Sysmessage
from Pressuretest import login
from Pressuretest.Simplerequest import Simplerequest
from RegisterHandler import RegisterHandler
from Settings import PaswChange
from TRends.TRendspost import TRendspost
from TRends.TrendHandler import TrendHandler
from Userinfo.Userforgotpw import Userforgotpw
from Userinfo.UserCollectionHandler import UserCollectionHandler
from Userinfo.UserFavoriteHandler import UserFavorite
from Userinfo.UserImgHandler import UserImgHandler
from Userinfo.UserIndent import UserIndent
from Userinfo.UserInfo import UserInfo
from Userinfo.UserLike import FindUlike
from Userinfo.UserList import UserList
from Userinfo.Userhomepager import Userhomepager
from Userinfo.Userhpimg import Userhpimg
from loginHandler import LoginHandler
define("port", default=800, help="run on the given port", type=int)
class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/appointment/create", APcreateHandler),
(r"/pressuretest",Simplerequest),
(r"/pressuretest2", login.login),
(r"/appointment/ask", APaskHandler),
(r"/appointment/prase", APprase),
(r"/appointment/regist", APregistHandler),
(r"/login", LoginHandler),
(r"/regist", RegisterHandler),
(r"/user/homepager",Userhomepager),
(r"/user/mylike", FindUlike),
(r"/user/favorite", UserFavorite),
(r"/user/info",UserInfo),
(r"/user/indent",UserIndent),
(r"/Activity/ask", AskActivity),
(r"/Activity/entry", AskEntry),
(r"/activity/create", ActivityCreate),
(r"/activity/register",ActivityRegister),
(r"/ImageCallback",ImageCallback),
(r"/PaswChange",PaswChange),
(r"/trend/Trendspost",TRendspost),
(r"/trend/Trendhanler",TrendHandler),
(r"/ranklist", Ranklist),
(r"/appointment/chat",APchatCreateHandler),
(r"/Userinfo/imghandler",Userhpimg),
(r"/Userinfo/CollectionHandler",UserCollectionHandler),
(r"/appointment/companion",ApCompanionHandler),
(r"/sysmessage",Sysmessage),
(r"/recommend/reclist",UserList),
(r"/companion/getauth", AcAuthHandler),
(r"/user/forgotpw",Userforgotpw),
]
tornado.web.Application.__init__(self, handlers)
self.db = scoped_session(sessionmaker(bind=engine,
autocommit=False, autoflush=True,
expire_on_commit=False))
# session负责执行内存中的对象和数据库表之间的同步工作 Session类有很多参数,使用sessionmaker是为了简化这个过程
if __name__ == "__main__":
print "HI,I am in main "
tornado.options.parse_command_line()
Application().listen(options.port)
try:
tornado.ioloop.IOLoop.instance().start()
except KeyboardInterrupt:
tornado.ioloop.IOLoop.instance().stop()