Использование библиотеки django-sass-processor в django, но она отказывается применять стиль, потому что ее MIME-тип не является поддерживаемым таблицей стилей
I'm using Sass for my Django(3.2.6) website with the help of libraries called django-compressor and django-sass-processor to compile it to a .css file. It works fine during development but when I try to disable the DEBUG mode in the settings the error will pop-up.
Refused to apply style from 'http://127.0.0.1:8000/static/styles.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Установка библиотеки Я добавил следующий код в свой settings.py (между строками ----):
.Здесь приведена структура файлов моей статической директории ДО запуска библиотеки:
.
├── public (folder for images)
├── _scss (folder for .scss files)
└── styles.scss
AFTER running library, it created two files called styles.css.map and styles.css:
.
├── public
├── _scss
├── styles.css
├── styles.css.map
└── styles.scss
To access scss tags, HTML now use {% load scss_tags %} tag, here is my head.html:
{% load sass_tags %}
<head>
<meta charset="UTF-8">
<link href="http://gmpg.org/xfn/11" rel="profile">
<link type="text/plain" rel="author" href="{% url 'index' %}/humans.txt">
<!-- Enable responsiveness on mobile devices-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta property="og:title" content="{{ site_title }}">
<meta property="og:site_name" content="{{ site_brand_name }}">
<meta property="og:url" content="{% url 'index'} %">
<meta property="og:description" content="{{ site_description }}">
<meta property="og:type" content="website">
<meta property="og:image" content="{% sass_src 'public/meta-img.png' %}">
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v2.0.1/css/unicons.css">
<title>
{% block title %}
Open Siena Files
{% endblock title %}
</title>
<!-- CSS -->
<link type="text/css" rel="stylesheet" href="{% sass_src 'styles.scss' %}" >
<!-- Icons -->
<link rel="shortcut icon" href="{% sass_src 'public/favicon.ico' %}">
</head>
Но при запуске без режима DEBUG браузер выдает ошибку. YES YES YES. Я уже искал решение, но ничего не подходит к конкретной проблеме, связанной с библиотекой, конвертирующей scss в css.