Не работает файл css в python django
делаю темную тему для шаблона в проекте django у меня есть базовый шаблон, находящийся в отдельной папке layout
{% load static %}
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- другие link -->
<link rel="stylesheet" href="{% static 'CSS/light.css' %}" id="theme">
<title>Color battle</title>
</head>
<body>
{% block home %}
{% endblock %}
</body>
<script src="{% static 'JS/scripting.js' %}"></script>
</html>
light.html - основной шаблон, который находится в другой папке и меняется на шаблон dark.html при нажатии на кнопку в profile.html
<div>
<button id="switchMode">Меняй</button>
</div>
к кнопке подключен script.js
let switchMode = document.getElementById("switchMode");
switchMode.onclick = function () {
let theme = document.getElementById("theme");
if (theme.getAttribute("href") == "light.css") {
theme.href = "dark.css";
} else {
theme.href = "light.css";
}
}
скрипт принимается и light.css отображает profile.html со всеми стилями, но после нажтия на кнопку все стили пропадают и выводится ошибка(Vanilin_Ivanov - имя пользователя)
Refused to apply style from 'http://127.0.0.1:8000/profile/Vanilin_Ivanov/dark.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
я знаю, что это говорит о том, что css файл не найдет, но он же правильно подключен и отображает стили, что делать?