forked from EchoUtopia/webTimer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.py
executable file
·44 lines (35 loc) · 1.19 KB
/
server.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
import os
import tornado.httpserver
import tornado.ioloop
import tornado.web
from conf import conf
from web_handlers import *
class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/", HomeHandler),
(r"/auth/register", RegisterHandler),
(r"/auth/login", LoginHandler),
(r"/auth/logout", LogoutHandler),
(r"/upload", UploadHandler),
(r"/day", DayHandler),
(r"/week", WeekHandler),
(r"/month", MonthHandler),
(r"/year", YearHandler),
]
_settings = dict(
template_path=os.path.join(os.path.dirname(__file__), "../www/templates"),
static_path=os.path.join(os.path.dirname(__file__), "../www/static"),
cookie_secret="..",
login_url="auth/login",
debug=True,
serve_traceback=True,
autoescape=True,
)
super(Application, self).__init__(handlers, **_settings)
def main():
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(conf.HTTP_PORT)
tornado.ioloop.IOLoop.current().start()
if __name__ == "__main__":
main()