Django can't find my static files despite all the right settings...

There is an image of what my browser sees and also showing the project structure on the left.

My corresponding reads:

Django settings for abstract_spacecraft project.

Generated by 'django-admin startproject' using Django 3.1.5.

For more information on this file, see

For the full list of settings and their values, see

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
SETTINGS_PATH = os.path.dirname(os.path.dirname(__file__))

# Quick-start development settings - unsuitable for production
# See

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '=p_lram126h4^=5e80@h3)c_&%xebx_3)wx1@o3t$o0mi-4m%x'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True


# Application definition



ROOT_URLCONF = 'abstract_spacecraft.urls'

TEMPLATES_PATH = os.path.join(SETTINGS_PATH, 'templates')

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
                 os.path.join(TEMPLATES_PATH, 'accounts')],
        'APP_DIRS': True,
        'OPTIONS': {
            'debug': True,
            'context_processors': [

WSGI_APPLICATION = 'abstract_spacecraft.wsgi.application'

# Database

    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',

# Password validation

        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',

# Internationalization



USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)

STATIC_URL = '/static/'

  os.path.join(SITE_ROOT, 'static/'),

So how do I force Django to see my static files? It seems that although Django is supposed to work well / nicely with its templating system, I can never get it to find the templates properly (without having to write in the app dir to the template dirs in, nor can I get it to find the static files. I’ve done nothing to this boilerplate project (generated by WingWare), except add an accounts app. I’m trying to get BSS to export to Django, and I can modify where the static files get sent to. I just need help getting Django to know where they are. Where’s the best place to put them and why the heck can’t Django just work out-of-the-box. This is annoying as a developer.

Okay, I did some debugging and found that if I do:

SITE_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
  os.path.join(SITE_ROOT, 'static/'),

i.e. two iterates of dirname() in my browser errors are partially taken care of. So that was the solution, just to debug it myself :slight_smile:

1 Like