{"id":344280,"date":"2023-01-21T09:01:54","date_gmt":"2023-01-21T09:01:54","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=344280"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=344280","title":{"rendered":"<span>\u041a\u0430\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 SASS\/SCSS \u043a Django<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>&#171;\u0422\u0430\u0447\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u043a\u0430\u0447\u043a\u0443&#187; \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u043d\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442. \u0410 \u0432\u043e\u0442 &#171;Django \u043d\u0430 \u043f\u0440\u043e\u043a\u0430\u0447\u043a\u0443&#187; \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0432\u0430\u0441 \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c. \u0412 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u043c \u044d\u043f\u0438\u0437\u043e\u0434\u0435 \u043c\u044b:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u0423\u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <strong>\u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b<\/strong> \u0438 \u0447\u0435\u043c \u043e\u043d\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e CSS;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0441 <strong>SASS<\/strong> \u0438 <strong>SCSS<\/strong>, \u0443\u0437\u043d\u0430\u0435\u043c, \u0447\u0435\u043c \u043e\u043d\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u0418 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SASS\/SCSS \u0432 <strong>Django<\/strong>-\u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<p>\u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u043c\u0435\u043d\u044c\u0448\u0435 \u0431\u043e\u043b\u0442\u043e\u0432\u043d\u0438 \u2013 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430. \u0426\u0435\u043d\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u041c\u0430\u043a\u0441. \u0412\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0415\u0433\u043e\u0440. \u0421\u0442\u0430\u0442\u044c\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u044b \u043a\u0430\u043d\u0430\u043b\u0430 <a href=\"https:\/\/www.youtube.com\/@pylounge\" rel=\"noopener noreferrer nofollow\">PyLounge<\/a>. \u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/df3\/49c\/4eb\/df349c4eb530a8d44f7d3c5e1dfc6038.png\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/df3\/49c\/4eb\/df349c4eb530a8d44f7d3c5e1dfc6038.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0430\u044f \u0440\u0443\u0431\u0440\u0438\u043a\u0430 <em>\u00ab\u0412 \u043f\u0430\u0440\u0435 \u0441\u043b\u043e\u0432 \u043f\u0440\u043e\u00bb<\/em>.<\/p>\n<p><strong>\u041f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 CSS<\/strong> \u2013 \u044d\u0442\u043e \u043a\u0430\u043a \u0431\u044b <em>\u00ab\u044f\u0437\u044b\u043a\u00bb<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 <strong>CSS<\/strong> \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u043f\u0430\u0440\u0438\u0442\u0441\u044f \u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0442.\u0434. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c CSS \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0430\u0442\u043a\u0438\u043c, \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c, \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u043c, \u043c\u043e\u0434\u043d\u044b\u043c \u0438 \u043c\u043e\u043b\u043e\u0434\u0435\u0436\u043d\u044b\u043c.<\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e CSS-\u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430 \u0441\u043b\u0443\u0445\u0443 <em>SASS\/SCSS<\/em> \u0438 <em>LESS<\/em>.<\/p>\n<p><strong>LESS<\/strong> \u2013 \u044d\u0442\u043e \u043d\u0430\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430\u0434 CSS, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u0412\u0432\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, function-like \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u0440\u0438\u043c\u0435\u0441\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e.<\/p>\n<p><strong>SASS<\/strong> \u2013 \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0441\u043a\u0430\u0434\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439 CSS. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c CSS, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438: <em>\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043f\u0440\u0438\u043c\u0435\u0441\u0438, \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u044b<\/em>. <\/p>\n<p>\u0423\u00a0SASS\u00a0\u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430, \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438 \u0432\u0442\u043e\u0440\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u043f\u043e\u0434 \u0432\u043b\u0438\u044f\u043d\u0438\u0435\u043c LESS, \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>SCSS<\/strong>.<\/p>\n<p>\u0427\u0442\u043e LESS, \u0447\u0442\u043e SASS \u2013 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u043e\u0447\u043a\u0438 \u0447\u0438\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430. \u041f\u043e\u0442\u043e\u043c \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0438\u0445 \u043a\u043e\u0434 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 CSS.<\/p>\n<p>\u041a\u0430\u043a \u043f\u043e \u043c\u043d\u0435 SASS, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 SCSS \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0434\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0435\u0433\u043e.<\/p>\n<p>\u0410 \u0432\u043e\u043e\u0431\u0449\u0435, \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0441\u043b\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0442\u044b \u0437\u043d\u0430\u0435\u0448\u044c CSS.<\/p>\n<p>\u0421 \u043f\u043e\u043d\u044f\u0442\u0438\u0439\u043d\u044b\u043c \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043e\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0443\u0441\u0442\u043e\u0439 Django \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043d\u0430\u0437\u043e\u0432\u0443 <strong>django_sass. <\/strong>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u041a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <strong>mkdir<\/strong> \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u043f\u0430\u043f\u043a\u0443 <strong>django_sass;<\/strong><\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0418 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u043d\u0435\u0435 \u0447\u0435\u0440\u0435\u0437 <strong>cd<\/strong>;<\/p>\n<p>4.\u00a0\u00a0\u00a0\u00a0 \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c <strong>\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/strong> python \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 <strong>venv;<\/strong><\/p>\n<p>5.\u00a0\u00a0\u00a0\u00a0 \u0418 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0435\u0433\u043e <strong>\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c<\/strong>. \u041d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 <strong>env<\/strong>;<\/p>\n<pre><code class=\"bash\">mkdir D:\\django_sass cd \/d D:\\django_sass python -m venv env .\\env\\Scripts\\activate<\/code><\/pre>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 <strong>pip<\/strong> \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <strong>Django<\/strong>,<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 <strong>libsass<\/strong> \u2013 \u043c\u043e\u0434\u0443\u043b\u044c-\u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 LibSASS, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 \u0421++;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 <strong>django-compressor<\/strong> \u2013 \u043e\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438 \u0441\u0436\u0438\u043c\u0430\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 inline Javascript \u0438 CSS \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 Django \u0432 \u043a\u044d\u0448\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b. \u0422\u0430\u043a\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 LESS \u0438 SASS. <\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u043d\u0430\u043c \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043d\u0443\u0436\u0435\u043d, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d sass-\u0444\u0430\u0439\u043b. \u041d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 css \u0438 js \u0444\u0430\u0439\u043b\u043e\u0432 \u043c\u043d\u043e\u0433\u043e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u044d\u0442\u0430 \u0448\u0442\u0443\u043a\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u044f \u0435\u0435 \u043d\u0435 \u043c\u043e\u0433.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/472\/031\/894\/472031894cbb40405c53d0a396b44d35.png\" alt=\"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 django-compressor: https:\/\/django-compressor.readthedocs.io\/en\/stable\/usage.html\" title=\"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 django-compressor: https:\/\/django-compressor.readthedocs.io\/en\/stable\/usage.html\" width=\"785\" height=\"517\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/472\/031\/894\/472031894cbb40405c53d0a396b44d35.png\"\/><figcaption>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 django-compressor: https:\/\/django-compressor.readthedocs.io\/en\/stable\/usage.html<\/figcaption><\/figure>\n<p>4.\u00a0\u00a0\u00a0\u00a0 <strong>django-sass-processor<\/strong> \u2013 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c SASS\/SCSS \u0444\u0430\u0439\u043b\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0436\u0430\u043d\u0433\u043e\u0432\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0433\u043e\u0432. \u0414\u0430\u043b\u044c\u0448\u0435 \u044f \u0435\u0449\u0435 \u043e\u0431\u0440\u0430\u0449\u0443 \u0432\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e.<\/p>\n<pre><code class=\"bash\">python -m pip install django python -m pip install libsass django-compressor django-sass-processor<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0441\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u0421\u043e\u0437\u0434\u0430\u0435\u043c Django-\u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 <strong>django-admin<\/strong>;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0441\u0432\u0435\u0436\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0418 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<pre><code class=\"bash\">django-admin startproject django_sass cd django_sass python manage.py startapp test_sass<\/code><\/pre>\n<p>\u041d\u0430\u0434\u043e <em>\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c<\/em> \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a Django-\u043f\u0440\u043e\u0435\u043a\u0442\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <em>settings.py<\/em> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0418 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0443 \u0441\u0440\u043e\u043a, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u2013 \u0432 \u043a\u043e\u043d\u0435\u0446 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <em>INSTALLED_APPS<\/em> \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <strong>test_sass <\/strong>\u0438<strong> <\/strong>\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <strong>sass_processor<\/strong>.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/078\/1aa\/1b4\/0781aa1b483cd9fa77315539ff53da5b.png\" alt=\"\u0424\u0430\u0439\u043b settings.py\" title=\"\u0424\u0430\u0439\u043b settings.py\" width=\"402\" height=\"257\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/078\/1aa\/1b4\/0781aa1b483cd9fa77315539ff53da5b.png\"\/><figcaption>\u0424\u0430\u0439\u043b settings.py<\/figcaption><\/figure>\n<p>Django-sass-processor \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c <em>\u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0438\u043a\u043e\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/em>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 CSS-\u0444\u0430\u0439\u043b\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u044d\u0442\u043e\u0442 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0438\u043a \u043d\u0430\u0434\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 Django \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0427\u0443\u0442\u043e\u0447\u043a\u0443 \u043d\u0438\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"python\">STATICFILES_FINDERS = [     'django.contrib.staticfiles.finders.FileSystemFinder',     'django.contrib.staticfiles.finders.AppDirectoriesFinder',     'sass_processor.finders.CssFinder', ]<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/66f\/c94\/13f\/66fc9413f59b8121318d188b6092c621.png\" alt=\"\u0412\u0441\u0451 \u0435\u0449\u0451 \u0444\u0430\u0439\u043b settings.py\" title=\"\u0412\u0441\u0451 \u0435\u0449\u0451 \u0444\u0430\u0439\u043b settings.py\" width=\"497\" height=\"296\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/66f\/c94\/13f\/66fc9413f59b8121318d188b6092c621.png\"\/><figcaption>\u0412\u0441\u0451 \u0435\u0449\u0451 \u0444\u0430\u0439\u043b settings.py<\/figcaption><\/figure>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c <em>\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b<\/em> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 CSS, JS \u0444\u0430\u0439\u043b\u044b) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Django, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430\u0448 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <strong><em>STATIC_ROOT<\/em><\/strong>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 Django, \u0433\u0434\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u043d\u0430\u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c <strong><em>SASS_PROCESSOR_ROOT<\/em><\/strong>, \u0447\u0442\u043e\u0431\u044b Django \u0437\u043d\u0430\u043b, \u0433\u0434\u0435 \u043b\u0435\u0436\u0430\u0442 \u043d\u0430\u0448\u0438 SASS\u2019\u044b:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/74f\/df8\/fe6\/74fdf8fe62dfb1a9c914986127788d84.png\" width=\"485\" height=\"148\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/74f\/df8\/fe6\/74fdf8fe62dfb1a9c914986127788d84.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u0441\u0443\u043d\u0435\u043c \u0438\u0445 \u0432 \u0442\u043e\u0442 \u0436\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u043a\u0443\u0434\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 CSS \u0438 JS \u0444\u0430\u0439\u043b\u044b, \u0432 <em>\u043f\u0430\u043f\u043a\u0443<\/em> <em>static<\/em> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u043b\u043e \u0431\u044b \u0438 \u043b\u0443\u0447\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f SASS \u0438 SCSS \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c SASS_PROCESSOR_ROOT \u0432 \u044d\u0442\u043e\u0442 \u043a\u0430\u0442\u0430\u043b\u043e\u0433. \u041d\u043e \u043c\u043d\u0435 \u043f\u043e\u0444\u0438\u0433\u0443, \u044f \u0440\u043e\u043a\u0441\u0442\u0430\u0440 (\u0438\u0437\u0432\u0438\u043d\u0438\u0442\u0435).<\/p>\n<p>HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438 Django \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 <strong><em>templates<\/em><\/strong>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435. \u041d\u043e \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0443\u043a\u0430\u0436\u0435\u043c \u0441\u0440\u0430\u0437\u0443. \u0410 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0443\u043a\u0430\u0436\u0435\u043c, \u0447\u0442\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <em>templates<\/em> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 django. \u041f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043d\u0430\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <strong><em>TEMPLATE_DIR<\/em><\/strong> \u0438 \u0441\u043f\u0438\u0441\u043e\u043a <strong><em>TEMPLATES<\/em><\/strong>.<\/p>\n<pre><code class=\"python\">TEMPLATE_DIR = os.path.join(BASE_DIR, \"templates\")  TEMPLATES = [     {         'BACKEND': 'django.template.backends.django.DjangoTemplates',         'DIRS': [TEMPLATE_DIR,],         'APP_DIRS': True,         'OPTIONS': {             'context_processors': [                 'django.template.context_processors.debug',                 'django.template.context_processors.request',                 'django.contrib.auth.context_processors.auth',                 'django.contrib.messages.context_processors.messages',             ],         },     }, ]<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0430\u043f\u043a\u0443 <em>static<\/em> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0418 \u0437\u0430\u043e\u0434\u043d\u043e \u043f\u0430\u043f\u043a\u0443 <em>templates<\/em>, \u0442\u0430\u043c \u0436\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435. \u0412 \u043f\u0430\u043f\u043a\u0443 <em>templates<\/em> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u043f\u0443\u0441\u0442\u043e\u0439 \u0444\u0430\u0439\u043b <strong>index.html<\/strong>.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3ba\/000\/1b2\/3ba0001b2b0f2d683e91d370bdd34d37.png\" alt=\"\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\" title=\"\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\" width=\"452\" height=\"158\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3ba\/000\/1b2\/3ba0001b2b0f2d683e91d370bdd34d37.png\"\/><figcaption>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/figcaption><\/figure>\n<p>\u041c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0430 \u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c SASS \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <em>127.0.0.1:8000\/sass_page<\/em>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u0444\u0430\u0439\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <strong>urls.py<\/strong>;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0418 \u043f\u0440\u043e\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0430\u0434\u0440\u0435\u0441-\u043c\u0430\u0440\u0448\u0440\u0443\u0442;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442 \u043f\u043e \u043d\u0435\u043c\u0443, \u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <em>sass_page_handler<\/em>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<pre><code class=\"python\">from django.contrib import admin from django.urls import path from test_sass import views  urlpatterns = [     path('admin\/', admin.site.urls),     path('sass_page', views.sass_page_handler), ]<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <em>test_sass<\/em>;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0418 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <strong>views.py<\/strong>;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>sass_page_handler<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443 \u043d\u0430\u0448\u0443 <em>index.html<\/em> \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c SASS.<\/p>\n<pre><code class=\"python\">from django.shortcuts import render  # Create your views here. def sass_page_handler(request):     return render(request, 'index.html')<\/code><\/pre>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0440\u0430\u043d\u0435\u0435 \u043f\u0430\u043f\u043a\u0443 <strong><em>static<\/em><\/strong>;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0412 \u043d\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0443 <strong><em>css<\/em><\/strong>;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0410 \u0432 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0438 \u0441\u0430\u043c SASS-\u0444\u0430\u0439\u043b <strong><em>main.scss<\/em><\/strong>.<\/p>\n<p>4.\u00a0\u00a0\u00a0\u00a0 \u0414\u0430\u043b\u0435\u0435 \u0432 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0441\u0442\u0438\u043b\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>\u0442\u0435\u043a\u0441\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0441\u0435\u0445 h1 \u0442\u0435\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0436\u0430\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 body \u0431\u0443\u0434\u0435\u0442 20px, \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u0438 \u043a\u0440\u0430\u0441\u043d\u044b\u0439<\/em>;<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9ca\/bd5\/bcf\/9cabd5bcf5ca88dcf62d87f5a51c9d68.png\" width=\"459\" height=\"117\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9ca\/bd5\/bcf\/9cabd5bcf5ca88dcf62d87f5a51c9d68.png\"\/><figcaption><\/figcaption><\/figure>\n<pre><code class=\"css\">body {     h1 {     font-size: 20px;     text-align: center; color:red; } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0436\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u0432 \u0444\u0430\u0439\u043b index.html. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0443\u0434\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u0438 <strong><em>\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c main.s\u0441ss<\/em><\/strong> \u0444\u0430\u0439\u043b:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u0442\u0435\u0433 <strong>load sass_tags<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c SCSS-\u0444\u0430\u0439\u043b\u044b \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0417\u0430\u0442\u0435\u043c \u0432 <strong>link<\/strong>, \u0442\u0430\u043a\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u0433\u0430 <strong>sass_src<\/strong>, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 django-sass-processor, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u0434\u043e <em>main.s\u0441ss<\/em> \u0444\u0430\u0439\u043b\u0430 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0435\u0433\u043e;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u041d\u0443 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u043e\u0439 <em>html-\u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438<\/em> \u0434\u043b\u044f \u0432\u0438\u0434\u0430.<\/p>\n<pre><code class=\"xml\">{% load sass_tags %} &lt;!DOCTYPE html> &lt;html lang=\"en\">     &lt;head>         &lt;meta charset=\"UTF-8\">         &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">         &lt;link href=\"{% sass_src 'css\/main.scss' %}\" rel=\"stylesheet\" type=\"text\/css\"\/>         &lt;title>Django Sass&lt;\/title>     &lt;\/head>     &lt;body>         &lt;h1>\u042d\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u043e \u0441\u0442\u0438\u043b\u044f\u043c\u0438 SASS\/SCSS, \u0431\u0430\u0437\u0430\u0440\u044e&lt;\/h1>     &lt;\/body> &lt;html><\/code><\/pre>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0438 <em>\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043c<\/em> \u043d\u0430\u0448 django-\u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <strong><em>python manager.py runserver<\/em><\/strong><em>.<\/em><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0418 \u0432\u0432\u0435\u0434\u0435\u043c \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 <strong><em>127.0.0.1:8000\/sass_page<\/em><\/strong><\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/73b\/b16\/819\/73bb168195ab1138ec176310b6a0152a.png\" width=\"1001\" height=\"484\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/73b\/b16\/819\/73bb168195ab1138ec176310b6a0152a.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0441\u0435, SCSS \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u0430 \u0432\u044b \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u044b!<\/p>\n<hr\/>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434:<a href=\"https:\/\/github.com\/pylounge\/pylounge-django-sass\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/pylounge\/pylounge-django-sass<\/a><\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u043e\u0449\u0435 \u0432 \u0432\u0438\u0434\u0435\u043e\u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63cb8c21200df56fc186aa6c\" data-style=\"\" id=\"63cb8c21200df56fc186aa6c\" width=\"\"><\/div>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/711954\/\"> https:\/\/habr.com\/ru\/post\/711954\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>&#171;\u0422\u0430\u0447\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u043a\u0430\u0447\u043a\u0443&#187; \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u043d\u0435 \u0432\u044b\u0445\u043e\u0434\u0438\u0442. \u0410 \u0432\u043e\u0442 &#171;Django \u043d\u0430 \u043f\u0440\u043e\u043a\u0430\u0447\u043a\u0443&#187; \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0432\u0430\u0441 \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c. \u0412 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u043c \u044d\u043f\u0438\u0437\u043e\u0434\u0435 \u043c\u044b:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u0423\u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <strong>\u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b<\/strong> \u0438 \u0447\u0435\u043c \u043e\u043d\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e CSS;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0441 <strong>SASS<\/strong> \u0438 <strong>SCSS<\/strong>, \u0443\u0437\u043d\u0430\u0435\u043c, \u0447\u0435\u043c \u043e\u043d\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u0418 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SASS\/SCSS \u0432 <strong>Django<\/strong>-\u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<p>\u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u043c\u0435\u043d\u044c\u0448\u0435 \u0431\u043e\u043b\u0442\u043e\u0432\u043d\u0438 \u2013 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430. \u0426\u0435\u043d\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u041c\u0430\u043a\u0441. \u0412\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0415\u0433\u043e\u0440. \u0421\u0442\u0430\u0442\u044c\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u044b \u043a\u0430\u043d\u0430\u043b\u0430 <a href=\"https:\/\/www.youtube.com\/@pylounge\" rel=\"noopener noreferrer nofollow\">PyLounge<\/a>. \u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0430\u044f \u0440\u0443\u0431\u0440\u0438\u043a\u0430 <em>\u00ab\u0412 \u043f\u0430\u0440\u0435 \u0441\u043b\u043e\u0432 \u043f\u0440\u043e\u00bb<\/em>.<\/p>\n<p><strong>\u041f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 CSS<\/strong> \u2013 \u044d\u0442\u043e \u043a\u0430\u043a \u0431\u044b <em>\u00ab\u044f\u0437\u044b\u043a\u00bb<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 <strong>CSS<\/strong> \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u043f\u0430\u0440\u0438\u0442\u0441\u044f \u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0442.\u0434. \u0422\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c CSS \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0430\u0442\u043a\u0438\u043c, \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c, \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u043c, \u043c\u043e\u0434\u043d\u044b\u043c \u0438 \u043c\u043e\u043b\u043e\u0434\u0435\u0436\u043d\u044b\u043c.<\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e CSS-\u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430 \u0441\u043b\u0443\u0445\u0443 <em>SASS\/SCSS<\/em> \u0438 <em>LESS<\/em>.<\/p>\n<p><strong>LESS<\/strong> \u2013 \u044d\u0442\u043e \u043d\u0430\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430\u0434 CSS, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u0412\u0432\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, function-like \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u0440\u0438\u043c\u0435\u0441\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e.<\/p>\n<p><strong>SASS<\/strong> \u2013 \u044d\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0441\u043a\u0430\u0434\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439 CSS. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c CSS, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438: <em>\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043f\u0440\u0438\u043c\u0435\u0441\u0438, \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u044b<\/em>. <\/p>\n<p>\u0423\u00a0SASS\u00a0\u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430, \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438 \u0432\u0442\u043e\u0440\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u043f\u043e\u0434 \u0432\u043b\u0438\u044f\u043d\u0438\u0435\u043c LESS, \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>SCSS<\/strong>.<\/p>\n<p>\u0427\u0442\u043e LESS, \u0447\u0442\u043e SASS \u2013 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u043e\u0447\u043a\u0438 \u0447\u0438\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430. \u041f\u043e\u0442\u043e\u043c \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0438\u0445 \u043a\u043e\u0434 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 CSS.<\/p>\n<p>\u041a\u0430\u043a \u043f\u043e \u043c\u043d\u0435 SASS, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 SCSS \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0434\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0435\u0433\u043e.<\/p>\n<p>\u0410 \u0432\u043e\u043e\u0431\u0449\u0435, \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u0435\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0441\u043b\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0442\u044b \u0437\u043d\u0430\u0435\u0448\u044c CSS.<\/p>\n<p>\u0421 \u043f\u043e\u043d\u044f\u0442\u0438\u0439\u043d\u044b\u043c \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043e\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0443\u0441\u0442\u043e\u0439 Django \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043d\u0430\u0437\u043e\u0432\u0443 <strong>django_sass. <\/strong>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u041a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <strong>mkdir<\/strong> \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u043f\u0430\u043f\u043a\u0443 <strong>django_sass;<\/strong><\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0418 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u043d\u0435\u0435 \u0447\u0435\u0440\u0435\u0437 <strong>cd<\/strong>;<\/p>\n<p>4.\u00a0\u00a0\u00a0\u00a0 \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c <strong>\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/strong> python \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 <strong>venv;<\/strong><\/p>\n<p>5.\u00a0\u00a0\u00a0\u00a0 \u0418 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0435\u0433\u043e <strong>\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c<\/strong>. \u041d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 <strong>env<\/strong>;<\/p>\n<pre><code class=\"bash\">mkdir D:\\django_sass cd \/d D:\\django_sass python -m venv env .\\env\\Scripts\\activate<\/code><\/pre>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 <strong>pip<\/strong> \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <strong>Django<\/strong>,<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 <strong>libsass<\/strong> \u2013 \u043c\u043e\u0434\u0443\u043b\u044c-\u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 LibSASS, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0430 \u0421++;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 <strong>django-compressor<\/strong> \u2013 \u043e\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438 \u0441\u0436\u0438\u043c\u0430\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 inline Javascript \u0438 CSS \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 Django \u0432 \u043a\u044d\u0448\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b. \u0422\u0430\u043a\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 LESS \u0438 SASS. <\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u043d\u0430\u043c \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043d\u0443\u0436\u0435\u043d, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d sass-\u0444\u0430\u0439\u043b. \u041d\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 css \u0438 js \u0444\u0430\u0439\u043b\u043e\u0432 \u043c\u043d\u043e\u0433\u043e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u044d\u0442\u0430 \u0448\u0442\u0443\u043a\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u044f \u0435\u0435 \u043d\u0435 \u043c\u043e\u0433.<\/p>\n<figure class=\"full-width\"><figcaption>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 django-compressor: https:\/\/django-compressor.readthedocs.io\/en\/stable\/usage.html<\/figcaption><\/figure>\n<p>4.\u00a0\u00a0\u00a0\u00a0 <strong>django-sass-processor<\/strong> \u2013 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c SASS\/SCSS \u0444\u0430\u0439\u043b\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u0436\u0430\u043d\u0433\u043e\u0432\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u0430, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0433\u043e\u0432. \u0414\u0430\u043b\u044c\u0448\u0435 \u044f \u0435\u0449\u0435 \u043e\u0431\u0440\u0430\u0449\u0443 \u0432\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e.<\/p>\n<pre><code class=\"bash\">python -m pip install django python -m pip install libsass django-compressor django-sass-processor<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u0441\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u0421\u043e\u0437\u0434\u0430\u0435\u043c Django-\u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 <strong>django-admin<\/strong>;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0441\u0432\u0435\u0436\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0418 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<pre><code class=\"bash\">django-admin startproject django_sass cd django_sass python manage.py startapp test_sass<\/code><\/pre>\n<p>\u041d\u0430\u0434\u043e <em>\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c<\/em> \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a Django-\u043f\u0440\u043e\u0435\u043a\u0442\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <em>settings.py<\/em> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0418 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0443 \u0441\u0440\u043e\u043a, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u2013 \u0432 \u043a\u043e\u043d\u0435\u0446 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <em>INSTALLED_APPS<\/em> \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <strong>test_sass <\/strong>\u0438<strong> <\/strong>\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <strong>sass_processor<\/strong>.<\/p>\n<figure class=\"\"><figcaption>\u0424\u0430\u0439\u043b settings.py<\/figcaption><\/figure>\n<p>Django-sass-processor \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c <em>\u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0438\u043a\u043e\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/em>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 CSS-\u0444\u0430\u0439\u043b\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u044d\u0442\u043e\u0442 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0438\u043a \u043d\u0430\u0434\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 Django \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0427\u0443\u0442\u043e\u0447\u043a\u0443 \u043d\u0438\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"python\">STATICFILES_FINDERS = [     'django.contrib.staticfiles.finders.FileSystemFinder',     'django.contrib.staticfiles.finders.AppDirectoriesFinder',     'sass_processor.finders.CssFinder', ]<\/code><\/pre>\n<figure class=\"\"><figcaption>\u0412\u0441\u0451 \u0435\u0449\u0451 \u0444\u0430\u0439\u043b settings.py<\/figcaption><\/figure>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c <em>\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b<\/em> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 CSS, JS \u0444\u0430\u0439\u043b\u044b) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Django, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430\u0448 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <strong><em>STATIC_ROOT<\/em><\/strong>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 Django, \u0433\u0434\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u043d\u0430\u0434\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c <strong><em>SASS_PROCESSOR_ROOT<\/em><\/strong>, \u0447\u0442\u043e\u0431\u044b Django \u0437\u043d\u0430\u043b, \u0433\u0434\u0435 \u043b\u0435\u0436\u0430\u0442 \u043d\u0430\u0448\u0438 SASS\u2019\u044b:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u0441\u0443\u043d\u0435\u043c \u0438\u0445 \u0432 \u0442\u043e\u0442 \u0436\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u043a\u0443\u0434\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 CSS \u0438 JS \u0444\u0430\u0439\u043b\u044b, \u0432 <em>\u043f\u0430\u043f\u043a\u0443<\/em> <em>static<\/em> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u043b\u043e \u0431\u044b \u0438 \u043b\u0443\u0447\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f SASS \u0438 SCSS \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c SASS_PROCESSOR_ROOT \u0432 \u044d\u0442\u043e\u0442 \u043a\u0430\u0442\u0430\u043b\u043e\u0433. \u041d\u043e \u043c\u043d\u0435 \u043f\u043e\u0444\u0438\u0433\u0443, \u044f \u0440\u043e\u043a\u0441\u0442\u0430\u0440 (\u0438\u0437\u0432\u0438\u043d\u0438\u0442\u0435).<\/p>\n<p>HTML-\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438 Django \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 <strong><em>templates<\/em><\/strong>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435. \u041d\u043e \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0443\u043a\u0430\u0436\u0435\u043c \u0441\u0440\u0430\u0437\u0443. \u0410 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0443\u043a\u0430\u0436\u0435\u043c, \u0447\u0442\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <em>templates<\/em> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 django. \u041f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043d\u0430\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <strong><em>TEMPLATE_DIR<\/em><\/strong> \u0438 \u0441\u043f\u0438\u0441\u043e\u043a <strong><em>TEMPLATES<\/em><\/strong>.<\/p>\n<pre><code class=\"python\">TEMPLATE_DIR = os.path.join(BASE_DIR, \"templates\")  TEMPLATES = [     {         'BACKEND': 'django.template.backends.django.DjangoTemplates',         'DIRS': [TEMPLATE_DIR,],         'APP_DIRS': True,         'OPTIONS': {             'context_processors': [                 'django.template.context_processors.debug',                 'django.template.context_processors.request',                 'django.contrib.auth.context_processors.auth',                 'django.contrib.messages.context_processors.messages',             ],         },     }, ]<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0430\u043f\u043a\u0443 <em>static<\/em> \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0418 \u0437\u0430\u043e\u0434\u043d\u043e \u043f\u0430\u043f\u043a\u0443 <em>templates<\/em>, \u0442\u0430\u043c \u0436\u0435 \u0432 \u043a\u043e\u0440\u043d\u0435. \u0412 \u043f\u0430\u043f\u043a\u0443 <em>templates<\/em> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u043f\u0443\u0441\u0442\u043e\u0439 \u0444\u0430\u0439\u043b <strong>index.html<\/strong>.<\/p>\n<figure class=\"\"><figcaption>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/figcaption><\/figure>\n<p>\u041c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0430 \u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c SASS \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <em>127.0.0.1:8000\/sass_page<\/em>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u0444\u0430\u0439\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <strong>urls.py<\/strong>;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0418 \u043f\u0440\u043e\u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0430\u0434\u0440\u0435\u0441-\u043c\u0430\u0440\u0448\u0440\u0443\u0442;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442 \u043f\u043e \u043d\u0435\u043c\u0443, \u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <em>sass_page_handler<\/em>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<pre><code class=\"python\">from django.contrib import admin from django.urls import path from test_sass import views  urlpatterns = [     path('admin\/', admin.site.urls),     path('sass_page', views.sass_page_handler), ]<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <em>test_sass<\/em>;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0418 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <strong>views.py<\/strong>;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>sass_page_handler<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443 \u043d\u0430\u0448\u0443 <em>index.html<\/em> \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c SASS.<\/p>\n<pre><code class=\"python\">from django.shortcuts import render  # Create your views here. def sass_page_handler(request):     return render(request, 'index.html')<\/code><\/pre>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0440\u0430\u043d\u0435\u0435 \u043f\u0430\u043f\u043a\u0443 <strong><em>static<\/em><\/strong>;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0412 \u043d\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u043f\u043a\u0443 <strong><em>css<\/em><\/strong>;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0410 \u0432 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0438 \u0441\u0430\u043c SASS-\u0444\u0430\u0439\u043b <strong><em>main.scss<\/em><\/strong>.<\/p>\n<p>4.\u00a0\u00a0\u00a0\u00a0 \u0414\u0430\u043b\u0435\u0435 \u0432 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0441\u0442\u0438\u043b\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>\u0442\u0435\u043a\u0441\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0441\u0435\u0445 h1 \u0442\u0435\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0436\u0430\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0433\u0430 body \u0431\u0443\u0434\u0435\u0442 20px, \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u0438 \u043a\u0440\u0430\u0441\u043d\u044b\u0439<\/em>;<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<pre><code class=\"css\">body {     h1 {     font-size: 20px;     text-align: center; color:red; } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0436\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u0432 \u0444\u0430\u0439\u043b index.html. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0443\u0434\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u0438 <strong><em>\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c main.s\u0441ss<\/em><\/strong> \u0444\u0430\u0439\u043b:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u0442\u0435\u0433 <strong>load sass_tags<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c SCSS-\u0444\u0430\u0439\u043b\u044b \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0417\u0430\u0442\u0435\u043c \u0432 <strong>link<\/strong>, \u0442\u0430\u043a\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u0433\u0430 <strong>sass_src<\/strong>, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 django-sass-processor, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u0434\u043e <em>main.s\u0441ss<\/em> \u0444\u0430\u0439\u043b\u0430 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0435\u0433\u043e;<\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u041d\u0443 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u043e\u0439 <em>html-\u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438<\/em> \u0434\u043b\u044f \u0432\u0438\u0434\u0430.<\/p>\n<pre><code class=\"xml\">{% load sass_tags %} &lt;!DOCTYPE html> &lt;html lang=\"en\">     &lt;head>         &lt;meta charset=\"UTF-8\">         &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">         &lt;link href=\"{% sass_src 'css\/main.scss' %}\" rel=\"stylesheet\" type=\"text\/css\"\/>         &lt;title>Django Sass&lt;\/title>     &lt;\/head>     &lt;body>         &lt;h1>\u042d\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u043e \u0441\u0442\u0438\u043b\u044f\u043c\u0438 SASS\/SCSS, \u0431\u0430\u0437\u0430\u0440\u044e&lt;\/h1>     &lt;\/body> &lt;html><\/code><\/pre>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0438 <em>\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043c<\/em> \u043d\u0430\u0448 django-\u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <strong><em>python manager.py runserver<\/em><\/strong><em>.<\/em><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c:<\/p>\n<p>1.\u00a0\u00a0\u00a0\u00a0 \u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440;<\/p>\n<p>2.\u00a0\u00a0\u00a0\u00a0 \u0418 \u0432\u0432\u0435\u0434\u0435\u043c \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 <strong><em>127.0.0.1:8000\/sass_page<\/em><\/strong><\/p>\n<p>3.\u00a0\u00a0\u00a0\u00a0 \u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0441\u0435, SCSS \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u0430 \u0432\u044b \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u044b!<\/p>\n<hr\/>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434:<a href=\"https:\/\/github.com\/pylounge\/pylounge-django-sass\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/pylounge\/pylounge-django-sass<\/a><\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u043e\u0449\u0435 \u0432 \u0432\u0438\u0434\u0435\u043e\u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/63cb8c21200df56fc186aa6c\" data-style=\"\" id=\"63cb8c21200df56fc186aa6c\" width=\"\"><\/div>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/711954\/\"> https:\/\/habr.com\/ru\/post\/711954\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-344280","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=344280"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344280\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}