Пример #1
0
    def __init__(self):
        handlers = [
            (r"/", HomeHandler),
            (r"/login", LoginHandler),
            (r"/register", RegisterHandler),
            (r"/logout", LogoutHandler),
            (r"/ask/([^/]+)", AskShowHandler),
            (r"/feed", FeedHandler),
            (r"/ask/([^/]+)/answer", AnswerHandler),
            (r"/ask/([^/]+)/flag", FlagAskHandler),
            (r"/ask", AskHandler),
            (r"/answer/([^/]+)/vote", AnswerVoteHandler),
            (r"/comment/([^/]+)/([^/]+)", CommentHandler),
            (r"/ask", AskHandler),
            (r"/settings", SettingsHandler),
            (r"/([^/]+)", ProfileHandler),
        ]
        settings = dict(
            app_name=u"我知",
            template_path=os.path.join(os.path.dirname(__file__), "templates"),
            static_path=os.path.join(os.path.dirname(__file__), "static"),
            xsrf_cookies=True,
            cookie_secret="81o0TzKaPpGtYdkL5gEmGepeuuYi7EPnp2XdTP1o&Vo=",
            login_url="/login",
            session_secret='08091287&^(01',
            session_dir=os.path.join(os.path.dirname(__file__), "tmp/session"),
        )
        self.session_manager = session.TornadoSessionManager(
            settings["session_secret"], settings["session_dir"])
        tornado.web.Application.__init__(self, handlers, **settings)

        # Connection MongoDB
        connect(options.mongo_database)
Пример #2
0
 def __init__(self):
     handlers = [
         (r"/", HomeHandler),
         (r"/logout", LogoutHandler),
         (r"/webhook", WebhookHandler),
         (r"/callback", CallbackHandler),
         (r"/stars", UserStarHandler),
         (r"/follows", UserFollowingHandler),
         (r"/cities", UserCityhandler),
         (r"/f", FollowHandler),
         (r"/uf", UnfollowHandler),
         (r"/add", AddWebhookHandler),
         (r"/show", ShowHandler),
         (r"/login", LoginHandler),
         (r"/howitworks", HowHandler),
         (r"/stat", StatHandler),
         (r"/users", StatUserHandler),
         (r"/repos", StatRepoHandler),
         (r"/export", ExportHandler),
     ]
     self.session_manager = session.TornadoSessionManager(
         settings["session_secret"], settings["session_dir"])
     self.redis = redis.Redis()
     self.cache = RedisCacheBackend(self.redis)
     debug = False
     tornado.web.Application.__init__(self, handlers, **settings)
Пример #3
0
class Application(tornado.web.Application):
    def __init__(self):
        handlers = [
        (r"/", MainHandler),
        (r"/dblogin", DBLoginHandler),
        (r"/dblogout", DBLogoutHandler),
        (r'/dblogincheck', DBLoginCheckHandler),
    ]
    tornado.web.Application.__init__(self, handlers, **settings)
    self.session_manager = session.TornadoSessionManager(settings["session_secret"], settings["session_dir"])
Пример #4
0
    def __init__(self):

        handlers = [
            (r"/", MainHandler),
            (r"/wblogin", AuthLoginHandler),
            (r"/wblogout", AuthLogoutHandler),
            (r"/wblogin_check", AuthLoginCheckHandler),
            (r"/a/message/new", MessageNewHandler),
            (r"/a/message/updates", MessageUpdatesHandler),
        ]
        settings = dict(
            cookie_secret="43oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
            #login_url="/auth/login",
            session_secret='some secret password!!',
            session_dir='sessions',
            template_path=os.path.join(os.path.dirname(__file__), "templates"),
            static_path=os.path.join(os.path.dirname(__file__), "static"),
            xsrf_cookies=True,
        )
        tornado.web.Application.__init__(self, handlers, **settings)
        self.session_manager = session.TornadoSessionManager(
            settings["session_secret"], settings["session_dir"])