【问题标题】:Pelican on S3: theme not rendering properlyS3 上的 Pelican:主题未正确渲染
【发布时间】:2015-04-09 21:45:13
【问题描述】:

我已经按照http://docs.getpelican.com/en/3.5.0/quickstart.html#installation 中的说明在虚拟环境中安装了 Pelican。运行make html,然后运行make serve 确实会在localhost:8000 上产生预期的结果:内容和主题按预期呈现。但是,本地服务器发出警告:

WARNING:root:Unable to find file /favicon.ico/index.html or variations.

我运行make s3_upload 有和没有--guess-mime-type 选项。无论哪种情况,我都确保我的 s3 存储桶中的 css 文件具有正确的 mime 类型(文本/纯文本) CSS 文件必须具有 text/css 作为 mime 类型

 Done: Processed 1 article(s), 0 draft(s) and 0 page(s) in 0.35 seconds.
 s3cmd sync /home/theuser/virtualenvs/pelican/theblog/output/ s3://theuser.com --acl-public --delete-removed --guess-mime-type

文件确实上传到 s3,但博客未正确呈现(显然 css 指令无法识别)。我没有在我的测试 Markdown 文档中添加任何内联 css。

为什么博客不能从 s3 正确渲染?我应该在哪里寻找错误日志?谢谢。

编辑:

我通过http://jigsaw.w3.org/css-validator/ 运行博客,得到“恭喜,未发现错误”和“此文档验证为 CSS 级别 3”。

假设博客的 URI 是 www.theuser.com,我也尝试将 pelicanconf.pySITEURL 设置为

 SITEURL =  'http://s3.amazonaws.com/theuser.com'
 SITEURL =  'http://theuser.com'

【问题讨论】:

    标签: css amazon-s3 favicon pelican


    【解决方案1】:

    我不确定我在解决上述问题时还有什么问题,但删除 python-magic 就成功了。

    显然python-magic 不允许由s3cmd 设置正确的mime 类型,特别是对于CSS 文件:它们的mime 类型默认为text/plain。 CSS mime-type 必须在 S3 上设置为 text/css,否则 CSS 文件将被忽略。

    这个链接让我走上了正轨:http://worklog.kevinclarke.info/2014/08/28/fixing-css-mime-type-for-s3-octopress/

    【讨论】:

      猜你喜欢
      • 2019-03-11
      • 1970-01-01
      • 2013-03-03
      • 2012-09-30
      • 2012-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-04
      相关资源
      最近更新 更多