如何获得favicon.ico龙卷风的工作

时间:2013-06-26 03:32:56

标签: python-3.x tornado

龙卷风服务器默认不执行favicon.ico,所以我总是得到这些信息

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

我以各种方式使用web.staticfilehandler包括源代码示例,并且无法使其工作,我的工作如下所示。

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

我感觉如此倾倒,我必须重定向它,并且无法确定它是否适用于现实世界中的网页。

2 个答案:

答案 0 :(得分:8)

我改变了这个,这次我得到了我想要的东西

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

我在撰写帖子时得到了答案。

答案 1 :(得分:2)

我将favicon.ico放在gapi.analytics.ready(function () { /* * Authorize the user immediately if the user has already granted access. * If no access has been created, render an authorize button inside the * element with the ID "embed-api-auth-container". */ gapi.analytics.auth.authorize({ container: 'embed-api-auth-container', clientid: 'xxxxxxxx.apps.googleusercontent.com' }); /** * Create a new ViewSelector instance to be rendered inside of an * element with the id "view-selector-container". */ var viewSelector = new gapi.analytics.ViewSelector({ container: 'view-selector-container' }); // Render the view selector to the page. viewSelector.execute(); /* * Create a new DataChart instance with the given query parameters * and Google chart options. It will be rendered inside an element * with the id "chart-container". */ var dataChart1 = new gapi.analytics.googleCharts.DataChart({ query: { metrics: 'ga:newUsers, ga:users', dimensions: 'ga:date', 'start-date': beginDate, 'end-date': endDate }, chart: { container: 'chart1-container', type: 'COLUMN', options: { width: '100%', isStacked: true } } }); /* * Render the dataChart on the page whenever a new view is selected. */ viewSelector.on('change', function(ids) { dataChart1.set({ query: { ids: ids } }).execute(); }); }); 中,并将以下代码添加到html中。

.\static\

它会像这样生成:

<link rel="shortcut icon" href="{{ static_url('favicon.ico') }}">

就是这样。