Django 4.2 Unable to read my CSS file located within the static/css folder

Hi all,

I have an issue with my css stylesheet file being read when I run the project. CSS file is not being read at all. I have a JS folder with JavaScript files and that is being read but nothing for the CSS folder where the Stylesheet is located.

Is this a bug with Django 4.2? I am using Python 3.9. Could this be an issue? Reason for Python 3.9, I had a struggle accessing MySQL database, but that is a topic for another day.

The project is still in development stage, so DEBUG mode is set to True at the moment.

Please see below the current settings in

Below is the snippet for index.html, extending the layout.html where the link to the CSS file is included.
Home Page Extending Layout

Layout.html for the link to the CSS file.

Directory where the css file is located.
Statics Folder

Many thanks,

Note: Please do not post screenshots of code, etc. copy/paste the text into the body of your message, between lines of three backtick- ` characters. This means you’ll have a line of ```, then your code, then another line of ```.

Without being able to read your code, I’m going to work under the assumption that no - there’s no bug related to this in 4.2.

Also, please indicate whether a request is being made to the server for this file, and if the server is returning a 404; or if there’s no request being seen for this file.

Hi Ken,

Thanks for getting back to me.

I Will try my best to get my code below. I hope the below paints a better picture.

The snippet below is the layout.html where the Stylesheet has been referenced.

{% load static %}
<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">

    *<link rel=”stylesheet” href="{% static 'css/otjiherero.css' %}" type="text/css">*

    <link href="" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">

    <link rel="stylesheet" type="text/css" href="{% static "fontawesome/css/all.min.css" %}"/>

    <script src="{% static 'js/clock.js' %}"></script>

    <script src="{% static 'js/greetings.js' %}"></script>


        <nav class="navbar navbar-expand-lg navbar-dark bg-dark bg-spring text-capitalize">
More code has been excluded.

Below is the code

import os
from pathlib import Path

from django.contrib import staticfiles

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-iu8rcz27hx7^+&yn0ke=0$2*a09k5!q5cs$vwju1i1b#7a)pf*'

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


# Application definition




ROOT_URLCONF = 'otjiherero_django_v1.urls'

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

WSGI_APPLICATION = 'otjiherero_django_v1.wsgi.application'

# Database

    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'user_db',
        'USER': 'user',
        'PASSWORD': 'password',
        'HOST': 'localhost',
        'PORT': '3306',
        # '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


TIME_ZONE = 'Europe/London'

USE_I18N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)

STATIC_URL = "static/"

# STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
    BASE_DIR / "static/",

# Default primary key field type

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

Below is the output from the cmd line after running the: python runserver - this is after a hard refresh. It looks like all the files are being read but the stylesheet is not present. The Fontawesome and the .js files all shows the HTTP 200 code

Starting development server at
Quit the server with CTRL-BREAK.

Not Found: /
[08/Nov/2023 23:41:15] "GET / HTTP/1.1" 404 2179
[08/Nov/2023 23:41:25] "GET /omahi/ HTTP/1.1" 200 7123
[08/Nov/2023 23:41:32] "GET /omahi/ HTTP/1.1" 200 7123
[08/Nov/2023 23:41:33] "GET /static/js/clock.js HTTP/1.1" 200 2482
[08/Nov/2023 23:41:33] "GET /static/fontawesome/css/all.min.css HTTP/1.1" 200 102217
[08/Nov/2023 23:41:33] "GET /static/js/greetings.js HTTP/1.1" 200 552
[08/Nov/2023 23:41:33] "GET /static/fontawesome/webfonts/fa-solid-900.woff2 HTTP/1.1" 200 150020
Not Found: /favicon.ico
[08/Nov/2023 23:41:33] "GET /favicon.ico HTTP/1.1" 404 2230

Code for the for the app.

from django.urls import path

from . import views

urlpatterns = [
    path("", views.index, name="index")


The file

from django.shortcuts import render

from .models import Continent, ContinentRegions

# Create your views here.
def index(request):
    return render(request, "omahi/index.html", {
        "continentRegions": ContinentRegions.objects.all()

Main Application’s file

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
                  path("omahi/", include("omahi.urls")),

Note that you have invalid characters here:

*<link rel=”stylesheet” href="{% static 'css/otjiherero.css' %}" type="text/css">*
           ^          ^

You have “smart quotes” instead of regular quotes.

1 Like

Hi Ken,

Thanks for getting back to me.

I can confirm the smart quotes were the issue. The application is running perfectly fine now.

Many thanks for your assistance.