Many answers are here but try this too. I'm going to describe everything. forget and clear anything added before and just follow these hints
1- in your settings.py and INSTALLED_APPS
you should have
'django.contrib.staticfiles',
and also STATIC_URL = '/static/'
. by default it's exists in the end of your file but check again yourself
2- in settings.py your TEMPLATES
should be like as follow
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR,'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.static',
],
},
},
]
Do not try to add this again ! just check for mistakes
3- static
folder must be in the application directory not your main directory of project
project
-application
-migrations
-static
-templates
4- in static
folder create sub directories for your files for example
project
-application
-static
-css
-js
-img
-....
-....
and put your files to specific folder
5- now in your HTML file add {% load staticfiles %}
first of file and everywhere you need a static file try to add that like as follow
<link href="{% static "css/myStyleSheet.css" %}" rel="stylesheet">
or
<link rel="icon" href="{% static "img/favicon.png" %}">
If you follow these hints, everything should be OK. test and report again