Css and js as staticfiles

I started learning django by creating a small site some days ago. The problem is that I can`t make the plugin work properly. The plugin is a small bundle of css and js. I put it into static directory and wrote in settings.file

STATIC_URL = '/static/'
os.path.join(BASE_DIR, "static"),

Scripts and css work only on the main.html template where I put such lines

<link rel="stylesheet" href="static/btn/css/bvi.min.css" type="text/css">
<script src="{% static 'btn/js/js.cookie.js' %}"></script>
<script src="{% static 'btn/js/bvi-init.js' %}"></script>
<script src="{% static 'btn/js/bvi.min.js' %}"></script>

But when I go to the other page (news_main.html), plugin css don`t work there. News_main.html has such lines

{% extends 'main.html' %}
{% block title %}
    News Page
{% endblock %} 

When downloading this page Django server says

[20/Jun/2020 08:48:32] “GET /news/ HTTP/1.1” 200 3136
Not Found: /news/static/btn/css/bvi.min.css
[20/Jun/2020 08:48:32] “GET /news/static/btn/css/bvi.min.css HTTP/1.1” 404 2289

News_main.html looks similar to main.html when downloading but without plugin css.

I guess there is something wrong with the path of css file.

P.S. News dir is django app.

Is this in your test server using runserver or on a production site using something like uwsgi or gunicorn or some other wsgi/asgi container? (If you’re running in a production mode, did you do a collectstatic? Have you set STATIC_ROOT?)

It might be worth taking some time to review the relevant documentation on Managing Static Files.


It is my test server with runserver running on my local pc

Структура папок
Серийный номер тома: 00000200 C4A9:513B
│   ├───migrations
│   │   └───__pycache__
│   ├───static
│   │   └───btn
│   │       ├───css
│   │       └───js
│   ├───templates
│   │   └───news
│   └───__pycache__
│   └───__pycache__
│   └───btn
│       ├───css
│       └───js


Go ahead and review the documentation I referenced before, particularly the Configuring static files section and the STATICFILES_DIRS setting.

Ok. I will.) Thank you.
But it is unclear why js is reacheable and css not? They are in the same static directory.

Assuming that this is still what you have…

Your link on the css is different from that for the js in that you’re not using the `{% static … %} for defining the href.

Hooray! Thank you very much for helping!