My style.css
is placed in appname/static/appname/
.
My settings.py
has this code:
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static/"),
)
And in my base.html
I load it like this:
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'appname/style.css' %}">
But the styles are not loading.
If I remove STATICFILES_DIRS
and change STATIC_URL = '/static/'
to STATIC_URL = '/static/appname/'
, it works perfectly, but I guess it's not the best practice for the case I'll add any other app to the project later. What I might be doing wrong?
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static/"),)
means that django will search in the directoryrootproject/static/
, not in your appsstatic
. What is your directory structure?