Y
Y
Yaroslav2021-04-09 10:17:47
Django
Yaroslav, 2021-04-09 10:17:47

Why does Django only serve the last static file in the queue to the browser?

606ffcf7e6596500162509.png
Hello! Tell me, I've been fighting for the second day with the problem of static files. Django 3.2. I created a separate static folder, I collect all css, js, and icons files into it. The connection is on, django, for some reason unknown to me, gives the browser only the last included file. On the photo, line 14

<link href="{% static 'css/main.css' %}" type="text/css" rel="stylesheet" />

ignored, loaded 15.
<link href="{% static 'css/bootstrap/bootstrap.min.css' %}" type="text/css" rel="stylesheet" />

I delete 15, 14 is loaded. Accordingly, if I connect js at the end of the template, the last js file is loaded, everything above is ignored.
The IDE sees all the paths correctly, but even with the deletion of lines, it is clear that it still gives the file, but for some reason there is only one. Or maybe there should be another method instead of static? What could be the reason for this behavior of django, and how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yaroslav, 2021-04-15
@ManMadeMind

As a result, the problem is solved like this. Including CSS with a crutch, through a double connection of the same file. And I didn’t see the JS files in the js / django folder for one simple reason, apparently the name for the “js” folder is reserved in the new version, renamed it to just scripts and all the files became available.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question