【发布时间】:2017-05-13 05:53:16
【问题描述】:
我正在使用 tornado 构建 Web 服务器。现在一切准备就绪,我可以使用我的服务器的 IP 地址访问我的网站了。
另外,我有一个域名,但我不知道如何使用该域名访问我的服务器。
例如IP为a.a.a.a,域名为www.mysite.com。现在我可以使用www.mysite.com 访问我的网站,但只能访问索引页面。这意味着我无法访问所有子页面,例如www.mysite.com/page1.html。
这是我的代码:
class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/(.*js$)", tornado.web.StaticFileHandler, {'path': 'static/'}),
(r"/(.*css$)", tornado.web.StaticFileHandler, {'path': 'static/'}),
(r"/(.*xml$)", tornado.web.StaticFileHandler, {'path': 'static/'}),
(r"/(.*jpg$)", tornado.web.StaticFileHandler, {'path': 'static/'}),
(r"/(.*png$)", tornado.web.StaticFileHandler, {'path': 'static/'}),
(r"/(.*ico$)", tornado.web.StaticFileHandler, {'path': 'static/'}),
(r"/(.*country\.html$)", PageHandler),
(r"/(.*city\.html$)", PageHandler),
(r"/(.*look\.html$)", PageHandler),
(r"/(index)", SearchHandler),
(r"/$", IndexHandler),
]
settings = dict(
#template_path = os.path.join(os.path.dirname(__file__), "beejeen/"),
#static_path = os.path.join(os.path.dirname(__file__), "beejeen/"),
)
super(Application, self).__init__(handlers, **settings)
我想我应该为龙卷风做一些配置,但我不知道怎么做。
【问题讨论】: