After I redirect to another page(from homepage to another tamplate) css doesn't load
I have problem with my css file loading for specific templates(every beside homepage).
The path for my css file is:
Website/static/css/home.css
and when I enter my webpage I'm starting at homepage where everything is okay, but then when I try to go to another page(for example mydomain.com --> mydomain.com/something/) the css doesn't load and in console I see this:
http://example.com/something/static/css/home.css
"Refused to apply style from 'http://example.com/something/static/css/home.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled."
and I don't understand why does it now look for static css in different root path(If that's a problem?).
What I use is django, aws-ec2: my settings.py:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
my urls.py:
urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root = settings.STATIC_URL)
nginx conf:
location /static/ {
autoindex on;
alias /home/ubuntu/Website/static/;
}
homepage.html
<link rel="stylesheet" href="static/css/home.css" />
another template.html:
{% extends './homepage.html' %}
{% load static %}
Thanks in advance!