2013-03-06 47 views
1

我有一个目录static,我已经设置static_url_prefix/static/,所以我的HTML文件可以在server/static/panel.html访问。现在,我想将server/panel重定向到此URL。如何为Tornado制作漂亮的静态HTML网址?

我已经尝试了许多变化对应用(r"/(panel\.html)", tornado.web.StaticFileHandler, {'path': ''}),但他们没有工作:-(我怎样才能得到这个工作

+0

您可以发布您的应用程序初始化代码,我期望看到static_path被设置,如下面的示例http://www.tornadoweb.org/documentation/overview.html#static-files-and-aggressive-file-缓存但你没有提到它 – 2013-03-08 23:25:08

+0

@RodHyde:我在我的代码中有以下内容:''static_path':os.path.join(os.path.dirname(__ file__),'s tatic')' – Casebash 2013-03-18 00:58:38

回答

1

使用RedirectHandler尝试以下途径:?

(r"panel", tornado.web.RedirectHandler, {'url': '/static/panel.html'}) 
+0

谢谢,这很有用,但是如果URL没有改变,而是显示为'mysite.com/panel',我想要它。 – Casebash 2013-03-18 00:57:36