我的静态文件不能加载

anc_ · · 3680 次点击
一直以为路径问题呢, 结果刚刚打开 firebug, 发现提示 ` http://localhost:8080/static/css/pt_lib_macro.css 未载入,因为它的MIME类型 &#34;text/html&#34; 不是 &#34;text/css&#34;` 话说 mime 这包没有看懂, 不知道怎么设置mime.types <a href="/user/polaris" title="@polaris">@polaris</a>
#2
更多评论
polaris
社区,需要你我一同完善!
试试:`http.Handle(&#34;/static/&#34;, http.FileServer(http.Dir(ROOT)))` 其中 ROOT 是项目根目录,也就是 src 目录所在的目录
#1
polaris
社区,需要你我一同完善!
这个包暂时还没有研究过。但理论上来说,这个地方不需要用mime包啊
#3