2013-03-06 25 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