本文介绍了如何让 favicon.ico 在龙卷风上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tornado 服务器默认没有做 favicon.ico,所以我总是得到这样的信息

the tornado server didn't do the favicon.ico by default,so i always get the info like these

[W 130626 10:38:16 web:1514] 404 GET /favicon.ico (192.168.1.57) 0.57ms

我以各种方式使用 web.staticfilehandler,包括源代码的示例,但无法正常工作,我得到了如下所示的工作.

i use the web.staticfilehandler in various way include the source's example,and couldn't get it work, i got things work like this below.

handlers = [
    (r'/favicon.ico', tornado.web.StaticFileHandler,dict(url='/static/favicon.ico',permanent=False)),
    (r'/static/(.*)', tornado.web.StaticFileHandler, {"path": "plserver"}),
 ]

我感觉很糟糕,我必须重定向它,但不确定它是否可以在现实世界中的网页上运行.

i felt so dump,i have to redirect it and couldn't sure it will work on web page in real world.

推荐答案

而且我改成了这个,这次我有我想要的

And I changed it to this one, this time I've got what I want

handlers = [
    (r'/(favicon.ico)', tornado.web.StaticFileHandler, {"path": ""}),
 ]

我在写帖子时得到了答案.

这篇关于如何让 favicon.ico 在龙卷风上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 11:20