2015-02-24 50 views
2

我正在使用Heroku服务器上运行的Django 1.5应用程序。Bootstrap Glyphicons在Django制作中没有显示

本地我可以成功呈现Bootstrap Glyphicons,但是当将我的应用程序部署到Heroku时,它们显示的就像小空方块。

我还使用Django的压缩机1.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,半身人,regular.eot,glyphicons,半身人,经常.TTF和glyphicons,半身人,regular.woff正确上传到字体文件夹在我的CDN树:

cdn 
└── bootstrap 
    ├── css 
    ├── fonts 
    └── js 

我敢肯定,静态文件包含正确发生(的路径是正确的),但无法实现为什么他们只是在本地展示,而不是生产。也试图找出编码问题,但直到现在还没有线索。

回答

0

我在Heroku上一个类似的设置和使用的字体文件路径是这样的: static/bootstrap/fonts/glyphicons-halflings-regular.eot