问题
I'm having trouble with a static view, it is configured to serve files from the 'assets' folder on the server, and works fine for the following '/assets/img/hdr.png','/assets/style/default.css' however when trying to serve a web font it always returns 404 not found (despite the fact I have triple checked the file is in the correct locaiton ('/assets/font.woff')
Is there something additional I need to configure to allow non img/css files to be served?
config.add_static_view(name='assets', path='assets')
Thanks
回答1:
The path
argument should be an asset specification. This means you should prefix the path
with the name of your package mypkg:assets
.
回答2:
Not sure if it's still relevant to the OP, but I hit the same problem.
The reason was that setup.py install
simply didn't copy the font files, and the solution was to include all the font extensions in the MANIFEST.in
file.
来源:https://stackoverflow.com/questions/13960956/web-fonts-always-return-404-from-static-path