Answer the question
In order to leave comments, you need to log in
How to set up a style sheet for a web application written in django?
I am writing a site on django, I ran into a problem when designing the site using css. There is one application called "products". In the project directory, the html page template is located at products/templates/products/index.html, at the very beginning there is a css file connection in it:
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'products/style.css' %}">
and there is also a div block with id = "area" body {
background: white url("images/background.jpg") round;
}
#area {
color: black;
font-size: 40px;
}
py manage.py collectstatic
py manage.py runserver
<link rel="stylesheet" type="text/css" href="/static/products/style.css">
<ul>
<div id='area'><li><a href="/products/2">second test product!</a></li></div>
<div id='area'><li><a href="/products/1">Test Product!</a></li></div>
</ul>
li a {
color: green;
}
body {
background: white url("images/background.jpg") round;
}
which is the previous content of the style sheet. Answer the question
In order to leave comments, you need to log in
collectstatic collects the static of all connected applications (and libraries) into one folder, from where it should be given to nginx. runserver looks at the original static, not the collected one (otherwise even the admin panel would not work without collectstatic). Check where exactly the requested CSS file is given from: most likely, you are changing some other one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question