Issue adding static dir for CSS file import

Hi everyone,
Quite new within the game.
I’m trying a first project where I’m trying to switch from using tailwind css from the web to integrating it before going further.
My static is not found: error message
[18/Feb/2025 21:23:14] “GET /dashboard/appointments/ HTTP/1.1” 200 3955
Not Found: /dashboard/appointments/=/static/main.min.css
[18/Feb/2025 21:23:15] “GET /dashboard/appointments/=/static/main.min.css HTTP/1.1” 404 5052

Here is my project structure:

Therefore, how should I adjust :slight_smile: STATIC_URL = ‘/static/’

STATICFILES_DIRS = [os.path.join(BASE_DIR, ‘static’)]

Thanks for your help!

Welcome @ricmaire !

How are you trying to reference these files in your templates? (Please show one of the templates trying to load this file.)

Thanks Ken
all my urls are as follow:

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

from core.views import index, about
from userprofile.views import signup

urlpatterns = [
    path('', index, name='index'),
    path('dashboard/leads/', include('lead.urls')),
    path('dashboard/patients/', include('patient.urls')),
    path('dashboard/treatments/', include('treatment.urls')),
    path('dashboard/appointments/', include('appointment.urls')),
    path('dashboard/', include('dashboard.urls')),
    path('about/', about, name='about'),
    path('sign-up/', signup, name='signup'),
    path('log-in/', views.LoginView.as_view(template_name='userprofiles/login.html'), name='login'),
    path('log-out/', views.LogoutView.as_view(), name='logout'),
    path('admin/', admin.site.urls),
]

each of my app are structured the same:

One of my template looks like this:

{% extends "core/base.html" %}

{%block title%} Patients {% endblock %}

{% block content %}
    <div class="py-6 px-8">
        <h1 class="mb-4 text-xl">Patients</h1>
        <a href="{% url 'add_patient' %}" class="inline-block py-4 px-6 bg-teal-600 rounded-xl text-white">Add patient</a>

        {% if patients %}
            <div class="mt-6 flex justify-between">
                <p class="py-4 px-2 bg-gray-200 font-semibold w-full">Name</p>
                <p class="py-4 px-2 bg-gray-200 font-semibold w-full">Priority</p>
            </div>
            
            {% for patient in patients%}
                <div class="flex justify-between">
                    <p class="py-4 px-2 w-full {% cycle 'bg-gray-100' ''%}"><a href="{% url 'patients_detail' patient.id %}">{{patient.full_name}}</a> </p>
                    <p class="py-4 px-2 w-full {% cycle 'bg-gray-100' ''%}">{{ patient.get_priority_display}}</p>
                </div> 
            {% endfor %}
        {% else %}
            <p class="mt-6 px-2" > No patients found</p>
        {% endif %}
    </div>

    
{% endblock %}

and therefore my config.JS is as so:

/** @type {import ('tailwindcss').Config} */
module.exports = {
    content:[
        'patient/templates/patient/*.html',
        'core/templates/core/*.html',
        'lead/templates/lead/*.html',
        'dashboard/templates/dashboard/*.html',
        'appointment/templates/appointment/*.html',
        'treatment/templates/treatment/*.html',
        'userprofile/templates/userprofile/*.html',
    ],
    theme:{
        extends: {},
    },
    plugins:[],
}

Side Note: When posting code here, enclose the code between lines of three
backtick - ` characters. This means you’ll have a line of ```, then your code,
then another line of ```. This forces the forum software to keep your code
properly formatted. (I have taken the liberty of correcting your original posts.
Please remember to do this in the future.)

Unfortunately, none of this answers my question.

From what you’ve posted, I think we need to see core/base.html.

oops Ken thanks.
this is my core/base.html

{% load static %}
<!doctype html>

<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="={% static 'main.min.css' %}">
    <!-- <script src="https://unpkg.com/@tailwindcss/browser@4"></script>-->

    <title>{% block title %} {% endblock %}</title>

  </head>
  <body>
    <nav class="py-6 px-6 flex justify-between bg-teal-500">
        <a href="/" class="text-white"> OrthodontiX</a>

        <div class="space-x-4">
            <a href="{% url 'about' %}" class="text-white">About</a>
            {% if request.user.is_authenticated %}
                <a href="{% url 'dashboard' %}" class="py-4 px-6 bg-teal-600 rounded-xl text-white">Dashboard</a>
                <a href="{% url 'leads_list' %}" class="py-4 px-6 bg-teal-600 rounded-xl text-white">First times</a>
                <a href="{% url 'patients_list' %}" class="py-4 px-6 bg-teal-600 rounded-xl text-white">Patients</a>
                <a href="{% url 'appointments_list' %}" class="py-4 px-6 bg-teal-600 rounded-xl text-white">Appointments</a>
                <a href="{% url 'treatments_list' %}" class="py-4 px-6 bg-teal-600 rounded-xl text-white">Treatments</a>
                <form action="{% url 'logout' %}" method="POST">
                    {% csrf_token %}
                    <button type="submit" class="py-4 px-6 bg-red-600 rounded-xl text-white">Log out</button>
                </form>
            {% else %}
                <a href="{% url 'login' %}" class="py-4 px-6 bg-teal-600 rounded-xl text-white">Log in</a>
                <a href="{% url 'signup' %}" class="py-4 px-6 bg-teal-300 rounded-xl text-white">Sign up</a>
                
            {% endif %}
        </div>
    </nav>

    {% if messages %}
        <div class="py-6 px-6">
            {% for message in messages %}
            <div class="py-4 px-4 bg-teal-300 text-white rounded-xl">
                {{ message }}
            </div>
            {% endfor %}
        </div>
    {% endif %}


    {% block content %}
    {% endblock %}
  </body>
</html>

The problem is here:

1 Like

Indeed…
Thank you very much, especially for the speed of your response…