class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/", MainHandler),
(r"/auth/login", AuthLoginHandler),
(r"/auth/logout", AuthLogoutHandler),
(r"/a/message/new", MessageNewHandler),
(r"/a/message/updates", MessageUpdatesHandler),
]
settings = dict(
cookie_secret="43oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
login_url="/auth/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)
def add_handlers(self, host_pattern, host_handlers):
"""Appends the given handlers to our handler list.
Note that host patterns are processed sequentially in the
order they were added, and only the first matching pattern is
used. This means that all handlers for a given host must be
added in a single add_handlers call.
"""
super(Application, self).__init__(handlers, **settings)
# add handlers for sub domains
for sub_handler in sub_handlers:
# host pattern and handlers
self.add_handlers(sub_handler[0], sub_handler[1])
sub_handlers.append(site.sub_handlers) sub_handlers.append(blog.sub_handlers) sub_handlers.append(admin.sub_handlers) # wildcard subdomain handler for project should be the last one. sub_handlers.append(project.sub_handlers)
sub_handlers = ["^sites.poweredsites.org$",
[
(r"/", _WebsiteIndexHandler),
(r"/feeds", _WebsitesFeedsHandler),
(r"/([a-z0-9]{32})", _WebsiteHandler),
(r"/([^/]+)", WebsiteHandler),
]
]
sub_handlers = ["^[a-zA-Z_\-0-9]*\.poweredsites.org$",
[(r"/", ProjectIndexHandler),
(r"/top", ProjectTopHandler),
(r"/opensource", ProjectOpensourceHandler),
]
]
class ProjectIndexHandler(ProjectBaseHandler):
def get(self):
subdomain = self.request.host.split(".")[0]
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有