CSS 在 Django 管理中不起作用:来自 [css 文件 url] 的资源由于 MIME 类型(“text/html”)不匹配(X-Content-Type-选项:nosniff
CSS not working in Django admin: The resource from [css file url] was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff
Django admin 显示时没有 CSS 因为错误:
The resource from “my-website-address/static/admin/css/responsive.css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
CSS url 我可以在我的浏览器中打开它看起来不错。
如何修复 CSS 标准 Django 管理界面的显示?
我收到错误消息
Refused to apply style from '' because its MIME type
('text/html') is not a supported stylesheet MIME type, and strict MIME
checking is enabled.
因为我的 Cloudflare 手动创建的防火墙规则之一阻止了 CSS 个 URL。
我在打开我的 Cloudflare 仪表板时发现了这一点,并发现防火墙规则正在将 'JS challenge' 应用于 https://[my-website]/static/admin/css/
.
等 URL
因此,如果您的网站无法加载某些资源并且您收到有关 MIME type
的错误,请检查您的 Cloudflare 仪表板或尝试暂时禁用它。
以防 google 旅行者到达这里:在我的情况下,问题是我在生产中的 django 大升级后忘记调用“collectstatic”(apache + django 3.2,从 2.2)
最佳,何塞。-
Django admin 显示时没有 CSS 因为错误:
The resource from “my-website-address/static/admin/css/responsive.css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
CSS url 我可以在我的浏览器中打开它看起来不错。
如何修复 CSS 标准 Django 管理界面的显示?
我收到错误消息
Refused to apply style from '' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
因为我的 Cloudflare 手动创建的防火墙规则之一阻止了 CSS 个 URL。
我在打开我的 Cloudflare 仪表板时发现了这一点,并发现防火墙规则正在将 'JS challenge' 应用于 https://[my-website]/static/admin/css/
.
因此,如果您的网站无法加载某些资源并且您收到有关 MIME type
的错误,请检查您的 Cloudflare 仪表板或尝试暂时禁用它。
以防 google 旅行者到达这里:在我的情况下,问题是我在生产中的 django 大升级后忘记调用“collectstatic”(apache + django 3.2,从 2.2)
最佳,何塞。-