Web 字体总是从静态路径返回 404 [英] Web fonts always return 404 from static path

查看:43
本文介绍了Web 字体总是从静态路径返回 404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用静态视图时遇到问题,它被配置为从服务器上的assets"文件夹提供文件,并且适用于以下/assets/img/hdr.png"、/assets/"style/default.css' 但是,当尝试提供 Web 字体时,它总是返回 404 not found(尽管我已经三重检查了文件位于正确的位置('/assets/font.woff')

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')

是否需要配置一些额外的东西来允许提供非 img/css 文件?

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')

谢谢

推荐答案

path 参数应该是 资产规范.这意味着您应该在 path 前面加上包的名称 mypkg:assets.

The path argument should be an asset specification. This means you should prefix the path with the name of your package mypkg:assets.

这篇关于Web 字体总是从静态路径返回 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆