Had a similar question with an older version of Django...
trying to get my site to load with its css and js
This is the structure of my project
gradMVPV1
--> .idea
--> catalog
views
models
apps
....
--> gradMVPV1
settings
urls
wsgi
....
--> templates
---->static
css
js
...
---->index.html
db.sqlite3
manage.py
this is what I have on settings.py
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATE_DIR = os.path.join(BASE_DIR, 'templates')
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'templates/static')
Here is a screenshot of my page
Not sure if this helps at all but this is the css on my index.html file
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="static/css/bootstrap.css">
<link rel="stylesheet" href="static/vendors/linericon/style.css">
<link rel="stylesheet" href="static/css/font-awesome.min.css">
<link rel="stylesheet" href="static/vendors/owl-carousel/owl.carousel.min.css">
<link rel="stylesheet" href="static/vendors/lightbox/simpleLightbox.css">
<link rel="stylesheet" href="static/vendors/nice-select/css/nice-select.css">
<link rel="stylesheet" href="static/vendors/animate-css/animate.css">
<!-- main css -->
<link rel="stylesheet" href="static/css/style.css">
I have made these changes based on the answers given
settings.py
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',
],
STATIC_URL = 'templates/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'templates/static')
I have also made changes to my index.html file to this effect
{% load staticfiles %}
<!doctype html>
<link rel="stylesheet" href="{% static 'css/bootstrap.css' %}">
<link rel="stylesheet" href="{% static 'vendors/linericon/style.css' %}">
<link rel="stylesheet" href="{% static 'css/font-awesome.min.css' %}">
.....
I am however still getting the same issue, the index page loads with not css, js or images
