M
M
Maxim Stikharev2018-05-15 15:59:39
Django
Maxim Stikharev, 2018-05-15 15:59:39

Why doesn't static work on the server?

Help) Why doesn't it load static on the server?
at the site address like this in the static path

<link href="/var/opt/blog/static/css/bootstrap.min.css" rel="stylesheet" type="text/css" />

in settings.py
STATIC_URL = '/var/opt/blog/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

MEDIA_URL = '/var/opt/blog/media/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
in nginx
location /static/ {
        alias /var/opt/blog/static/;
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2018-05-15
@vintello

Yes, it's as simple as daylight.
turn on logging in the config to the debug level - and the static works, turn it
off and does not work.
we are surprised, we go to read the dock and suddenly we understand that the statics should be distributed not by janga, but by a server like nging, apache, gunicorn or whatever you use there

S
Stanislav Pugachev, 2018-05-15
@Stqs

porridge you have credit
1) where does MEDIA_ROOT to statics? why did you mention it? Do you understand the difference between them and the purpose of each of them?
2)
here I am sorry full PPC
do you understand how it should work?
3) what does STATIC_URL and STATIC_ROOT have to do with it if you are going to distribute nginx to statics?
why did you mention it? do you understand their purpose?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question