N
N
Nikita Juzz2022-04-18 16:09:55
css
Nikita Juzz, 2022-04-18 16:09:55

Changes from the css file are not loaded on the server, what should I do?

I'm building a site, and when I include css properties in the format

link rel="stylesheet" href="../../static/css/includes/header.css"


Everything works well and when I start the server
python mange.py runserver

If I make changes, they happen and in general everything works well.

But I am required to do links in a different way, through Django HTML
link rel="stylesheet" href="{% static 'css/includes/main-menu.css' %}"

And in this case, everything is very bad, I stop seeing any changes on the server that I prescribe in CSS.
But my friend who makes the backend, he sees all my changes (after the pool from the github). And in order for me to see the changes that I made, I need to ask a friend to submit my changes to heroku and only after that I can see the changes that I made to the CSS file.
Please tell me what could be wrong and how to fix it. I didn't find similar problems.

Here is the code if needed:
There is base.html:
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
    <link rel="icon" type="image/png" sizes="32x32" href="{% static 'img/logos.png' %}">
    <link rel="icon" type="image/png" sizes="16x16" href="{% static 'img/logos.png' %}">
    {% block links %}
    {% endblock links %}
    <title>
        {% block title %}
        {% endblock title %}
    </title>
</head>

<body>
    <header>
        {% include 'includes/header.html' %}
    </header>
    <main>
        {% block main_data %}
        {% endblock main_data %}
    </main>
    <footer>
        {% include 'includes/footer.html' %}
    </footer>
</body>

</html>


And here is the main-menu file:
{% extends 'base.html' %}
{% load static %}
{% block links %}
<link rel="stylesheet" href="{% static 'css/includes/slick.css' %}">
<link rel="stylesheet" href="{% static 'css/includes/slick-theme.css' %}">
<link rel="stylesheet" href="{% static 'css/includes/main-menu.css' %}">
{% endblock links %}
{% block title %}
Main-menu
{% endblock title %}
{% block main_data %}
<section class="slider">
    <div class="container">
        <div class="slider__inner">

            <div class="slider__item">
                <div class="slider__item-title">
                    Вы можете многому научиться
                </div>
            </div>

            <div class="slider__item">
                <div class="slider__item-title">
                    Ещё какой-то текст
                </div>
            </div>

            <div class="slider__item">
                <div class="slider__item-title">
                    Может быть реклама
                </div>
            </div>

            <div class="slider__item">
                <div class="slider__item-title">
                    Их можно удалить
                </div>
            </div>

            <div class="slider__item">
                <div class="slider__item-title">
                    Или если понадобиться добавить
                </div>
            </div>
            
        </div>
    </div>
</section>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="../../static/js/main.js"></script>
<script src="../../static/js/slick.min.js"></script>


{% endblock main_data %}


And if I make any changes in the main-menu,css file, then I cannot observe any changes on the local server.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mletov, 2022-04-18
@Nikita0802

https://stackoverflow.com/questions/3188544/django...

D
devope, 2022-04-18
@devope

Your browser is caching. You can add some hashid to the filename so that the browser perceives it as new.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question