Web fonts always return 404 from static path

只愿长相守 提交于 2020-01-05 07:36:10

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!