Answer the question
In order to leave comments, you need to log in
How to include statics in django on the server?
Such an ambush threw the project onto the server, everything started, but the ambush with static.
static on the server is collected here /home/sfc/sfc/public_html/static
in settings static_url = '/static/'
static_root = '/home/sfc/sfc/public_html/static/'
in nginx settings
location /static/ {
alias /home /sfc/sfc/public_html/static/;
} I
use the nginx + uwsgi + django 1.7 bundle
in the template, I don’t use static, I just substitute {{STATIC_URL}}
, as a result, the path is like this mysite/home/sfc/sfc/public_html/static/css/main.css
This is
the first time I deploy the project to server, so I will be glad if you explain what I'm doing wrong and how to do it right
Answer the question
In order to leave comments, you need to log in
You have confused STATIC_URL and STATIC_ROOT.
STATIC_ROOT - the path to the folder where the files are located on the server.
STATIC_URL - alias for this folder in web server settings.
Judging by the address you provided (mysite/home/sfc/sfc/public_html/static/css/main.css), you don't have
STATIC_URL = '/static/'
STATIC_ROOT = '/home/sfc/sfc/public_html/static/'
STATIC_ROOT = '/static/'
STATIC_URL = '/home/sfc/sfc/public_html/static/'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question