我正在开发运行在Heroku服务器上的Django 1.5应用程序。
在本地,我可以成功地渲染Bootstrap Glyphicons,但是当我将我的应用程序部署到Heroku时,它们只显示为小的空方块。
我还使用了django-Compreser1.3来处理我的资产,所以我捆绑的css文件看起来像这样:
@font-face {
font-family: 'Glyphicons Halflings';
src: url('http://static.myapp.com/bootstrap/fonts/glyphicons-halflings-regular.eot?528782f48380');
src: url('http://static.myapp.com/bootstrap/fonts/glyphicons-halflings-regular.eot?&528782f48380#iefix') format('embedded-opentype'), url('http://static.myapp.com/bootstrap/fonts/glyphicons-halflings-regular.woff?528782f48380') format('woff'), url('http://static.myapp.com/bootstrap/fonts/glyphicons-halflings-regular.ttf?528782f48380') format('truetype'), url('http://static.myapp.com/bootstrap/fonts/glyphicons-halflings-regular.svg?528782f48380#glyphicons_halflingsregular') format('svg');
}
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}并且glyphicons-halflings-rular.eot、glyphicons-halflings-rular.ttf和glyphicons-halflings-rular.woff文件正确上传到我的cdn树上的fonts文件夹:
cdn
└── bootstrap
├── css
├── fonts
└── js我确信静态文件的包含是正确的(路径是正确的),但是不知道为什么它们只在本地显示,而不是在生产环境中显示。我也试图找出编码问题,但到目前为止还没有线索。
发布于 2015-02-26 00:30:18
我在heroku上有一个类似的设置,并使用如下字体文件路径:static/bootstrap/fonts/glyphicons-halflings-regular.eot
https://stackoverflow.com/questions/28705187
复制相似问题