-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication.py
37 lines (34 loc) · 1.09 KB
/
application.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
#u -*- coding: utf-8 -*-
#
# Author: jimin.huang
#
# Created Time: 2015年03月04日 星期三 20时34分03秒
#
'''
A simple file to create a application instance
which defined the rules to match request
and load settings
实例化application的简单文件,
在这里定义请求的url匹配规则并读取服务器设置
'''
import tornado.web
import handlers
from settings import settings
'''
rules are defined as a tuple of a list like:
(r"[RE TEMPLATE]", [HANDLER CLASS])
规则以列表中的元组形式定义:
(r"[正则匹配模板]", [handler 类])
'''
application = tornado.web.Application([
(r"/", handlers.MainHandler),
(r"/list/(\w+)", handlers.ListHandler),
(r"/register", handlers.RegisterHandler),
(r"/login", handlers.LoginHandler),
(r"/logout", handlers.LogoutHandler),
(r"/collection", handlers.CollectionHandler),
(r"/settings(/\w+)*", handlers.SettingsHandler),
(r"/search", handlers.SearchHandler),
(r"/article/(\d+)", handlers.ArticleHandler),
(r".*", handlers.BaseHandler),
], **settings)