I realize this is an old post but just to provide another alternative.
Place the favicon.icon in the static folder, then
import web
urls = ('/favicon.ico','favicon')
app = web.application (urls, globals())
class favicon:
def GET(self):
raise web.seeother('/static/images/favicon.ico')
if __name__ == "__main__": app.run()
Avoids adding config to Apache (easy to forget if you move servers) and
avoids streaming by web.py. The downside, though, is that the browser gets
a 303 redirect on first request.
On Friday, September 23, 2011 6:45:13 PM UTC-4, voxtreet wrote:
>
> Hi,
>
> Just started using web.py, wrote my first web service in less than 10
> lines, so THANK YOU!
>
> My question is about the favicon.ico file. I built the web app from
> the tutorial, and run it directly from Python using the web.py built-
> in web server. Every time I access the web service from a browser
> (Chrome on Mac), I see in the logs a GET request for the URL I typed
> in, but also see a GET request for /favicon.ico, to which my server
> responds with a 404 Not Found error.
>
> It's not a problem, but it is an annoyance. When I deploy this to
> Apache, I will get an extra line in my error logs every time someone
> visits from a browser.
>
> I know this is a browser-specific issue (trying to find the icon to
> put in the address bar), so not a big deal if requests are coming
> directly from web apps. And I'm sure I could come up with some image
> and install a favicon.ico somewhere and get web.py to serve it up. But
> I'm just wondering if there is some way that web.py can "ignore" these
> requests, or rather, not result in so many 404 errors in my logs? E.g.
> some sort of built-in/default url mapping to some blank .ico data that
> comes with web.py, or something like that?
>
> Thanks!
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/webpy/-/jPTMv7cAme8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.