web.py development server - favicon.ico - 404 Not Found

tponthieux picture tponthieux · Jul 24, 2012 · Viewed 15.1k times · Source

When running a web.py application with the development server, how do you get rid of the 404 error for the favicon?

"HTTP/1.1 GET /" - 200 OK
"HTTP/1.1 GET /favicon.ico" - 404 Not Found

Everything I've been able to find about eliminating this error has to do with specifying a path to the resource in your Apache configuration. This obviously doesn't help with the development server use case. Is there a way to specify static resources in the urls tuple? Can you define a document root in the web.py application?

Answer

Anand Chitipothu picture Anand Chitipothu · Jul 25, 2012

Like Ryan Griggs suggested, but use /static/favicon.ico as href.

<html>
<head>
    <link rel="icon" type="image/png" href="/static/favicon.ico">
    ...

web.py dev server maps all /static/ URLs to files in static/ directory.