【发布时间】:2012-09-24 19:38:33
【问题描述】:
我正在尝试让媒体查询在 IE 8 中运行,并且 Respond.js 在开发中运行良好。但是,当我将其部署到我的生产环境时,Respond.js 无法正常工作,这很神奇。我已按照 GitHub 上的说明使用 CDN 进行设置(我们使用 S3 和 Cloudfront),并确保所有 javascript 和 respond-proxy.html 文件都可在我指定的 URL 中使用。
我目前的理论是,这是 Django 在途中某个地方停止了 Respond.js 的 AJAX,特别是,我的 Django 日志中的这一行证明了这一点:
WARNING Wed, 03 Oct 2012 15:22:13 +0000 base xxx xxxxxxx Not Found: /https://dxxxxxxxxxxxx.cloudfront.net/j/r/respond-proxy.html
它似乎试图在本地服务器上找到/https://d...。该行在每个页面请求中出现多次。
代码如下:
<link rel="stylesheet" type="text/css" media="screen" href="https://dxxxxxxxxxx.cloudfront.net/static/css/style.css" />
<script type="text/javascript" src="/static/js/respond.src.js"></script>
<link href="https://dxxxxxxxxxx.cloudfront.net/static/js/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />
<link href="/static/js/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />
<script type="text/javascript" src="/static/js/respond.proxy.js"></script>
请注意,我的 CSS 是使用 django-compressor 压缩的,我的其他 JS 也是如此。上面的代码在 {% compress %} 块之外。
【问题讨论】:
标签: django amazon-s3 amazon-cloudfront django-compressor