Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (40 sloc) 1.3 KB
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import logging
import tornado.auth
import tornado.escape
import tornado.ioloop
import tornado.options
import tornado.web
import os.path
import uuid
from tornado.options import define, options
from pymongo import Connection
from handlers.main import MainHandler
from handlers.user import *
define("port", default=8888, help="run on the given port", type=int)
class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/", MainHandler),
(r"/user/login", UserLoginHandler),
(r"/user/logout", UserLogoutHandler),
(r"/user/register", UserRegisterHandler),
]
settings = dict(
cookie_secret="43oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
login_url="/login",
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
xsrf_cookies=True,
autoescape="xhtml_escape",
)
tornado.web.Application.__init__(self, handlers, **settings)
self.db = Connection().codelate
def main():
tornado.options.parse_command_line()
app = Application()
app.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()