serving non-existent favicon.ico with staticfile throws error on refresh
See original GitHub issueOriginally reported by: @wyuenho
So apparently Tree.mount() attaches a static handler for favicon.ico if the root doesn’t already have a handler for it without even looking at the config. If the config has a section for /favicon.ico, but the file doesn’t exist, refreshing the browser will throw and error in the errorlog with something like this:
[17/Jan/2010:01:30:00] HTTP Traceback (most recent call last):
File "/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.5/site-packages/CherryPy-3.1.2-py2.5.egg/cherrypy/_cprequest.py", line 606, in respond
cherrypy.response.body = self.handler()
File "/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.5/site-packages/CherryPy-3.1.2-py2.5.egg/cherrypy/_cpdispatch.py", line 25, in __call__
return self.callable(*self.args, **self.kwargs)
File "/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.5/site-packages/CherryPy-3.1.2-py2.5.egg/cherrypy/_cptools.py", line 150, in handle_func
handled = self.callable(*args, **self._merged_args(kwargs))
TypeError: staticfile() got multiple values for keyword argument 'filename'
This obviously doesn’t even tell me what values it got, so the error message doesn’t even help. I’m not sure how to patch this because you need to obviously look at all the different kinds of dispatchers for the “/favicon.ico” key besides the default tree dispatcher, and I’m not familiar with all of them.
Reported by wyuenho@gmail.com
Issue Analytics
- State:
- Created 14 years ago
- Comments:13 (10 by maintainers)
Top Results From Across the Web
ValueError: Missing staticfiles manifest entry for 'favicon.ico'
Try running: python manage.py collectstatic. Does the test work now? If so, this might be the configuration causing a problem:
Read more >Favicon Not Showing Up - How to Fix In Chrome, Wordpress ...
It's frustrating when for some reason, your favicon is not showing up, and this can occur for many reasons we explain such as...
Read more >gin - Go Packages
StaticFile registers a single route in order to serve a single file of the local filesystem. router.StaticFile("favicon.ico", ".
Read more >Assets, CSS, Images, etc - SymfonyCasts
Refresh and... it doesn't! Error: Unknown function: did you forget to run composer require ... <link rel="icon" type="image/png" sizes="32x32" href="{{ ...
Read more >Using WhiteNoise with Django
Note, if the static file does not exist, it will still throw an error. This works by setting the manifest_strict option on the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In #1623 @sanjaySP suggested to register a custom path for favicon and explicitly specify that in your HTML pages as a workaround.
That patch removes the duplicate argument. But it “cures” the symptom, not an underlying issue. It looks like the fix should be done on a different level, being more fundamental. The patch might hide other problems if they happen, which would then be impossible to debug.
To truly fix the issue, we need to understand the flow across different components of the framework and why this is happening. Otherwise patching random places would be harmful.
Basically, this is why I postponed the fix, it needs mode dedicated investigation first.