django - 在 Heroku 上部署 Django 后 Chart.js 无法正常工作
问题描述
我的 Django 网站运行良好,localhost:8000
但是当我上传到 Heroku 时,图表不再显示。有什么典型的原因吗?我在控制台中收到的错误Uncaught Error: Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com
是The page at 'https://...com/' was loaded over HTTPS, but requested an insecure script 'http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js'. This request has been blocked; the content must be served over HTTPS.
解决方案
错误说明了一切。您尝试通过 http 加载即时脚本,但由于这是一个不安全的协议,oit 已被阻止,您必须通过 https 加载脚本。
https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js
推荐阅读
- javascript - 如何在全屏时更改 HTML5 页面
- php - PHPMailer 发送邮件但未送达
- ruby-on-rails - 自定义 Omniauth '身份验证失败!csrf_detected'
- html - 为什么当我上传使用手机拍摄的图像时,它会旋转?我该如何解决?
- excel - 将数据从一张纸复制到下一个空行的另一张纸上
- php - php array_walk 查找值的键
- spring-boot - 如何在基于 springboot 的 Web 项目中显示运行时日志记录?
- android - 无法检测到默认活动
- reactjs - 如何在 ReactJS 中连接名字和姓氏?
- css - 带有 CSS 的粘性侧边栏(无 javascript)