Q:

How to solve error static file not found django

I'm working on a project in which I used frontend template from online website .
but I think i have put every file in correct places but instead I'm getting static file not found error.
below are important file :
setting.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'lj6ra=$c5t!2kkin(qvuk3o(wui!m(%%wktf%my!c_gbl6(7ap'

DEBUG = True
ALLOWED_HOSTS = ['*']

STATICFILES_DIRS = (
  os.path.join(BASE_DIR, 'Gym/static/'),
)

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'Gym',
    
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'Gym.urls'

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',
            ],
        },
    },
]

WSGI_APPLICATION = 'Gym.wsgi.application'

# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        '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
# https://docs.djangoproject.com/en/3.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'

urls.py:
from django.contrib import admin
from django.urls import path,include
from . import views
from django.conf.urls.static import  static
from django.conf import settings

urlpatterns = [
    path('admin/', admin.site.urls),
    path('',views.index),
]

index.html :
    ...
    <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}" type="text/css">
    <link rel="stylesheet" href="{% static 'css/font-awesome.min.css' %}" type="text/css">
    <link rel="stylesheet" href="{% static 'css/elegant-icons.css' %}" type="text/css">
    <link rel="stylesheet" href="{% static 'css/nice-select.css' %}" type="text/css">
    <link rel="stylesheet" href="{% static 'css/owl.carousel.min.css' %}" type="text/css">
    <link rel="stylesheet" href="{% static 'css/magnific-popup.css' %}" type="text/css">
    <link rel="stylesheet" href="{% static 'css/slicknav.min.css' %}" type="text/css">
    <link rel="stylesheet" href="{% static 'css/style.css' %}" type="text/css">
    ...

Error i'm getting :
"""[02/Aug/2020 04:34:09] "GET /css/font-awesome.min.css HTTP/1.1" 404 2108
Not Found: /css/magnific-popup.css
Not Found: /css/nice-select.css
[02/Aug/2020 04:34:09] "GET /css/magnific-popup.css HTTP/1.1" 404 2102
Not Found: /css/owl.carousel.min.css
Not Found: /css/bootstrap.min.css
[02/Aug/2020 04:34:09] "GET /css/nice-select.css HTTP/1.1" 404 2093
Not Found: /css/elegant-icons.css
[02/Aug/2020 04:34:09] "GET /css/owl.carousel.min.css HTTP/1.1" 404 2108
[02/Aug/2020 04:34:09] "GET /css/bootstrap.min.css HTTP/1.1" 404 2099
Not Found: /css/slicknav.min.css
[02/Aug/2020 04:34:09] "GET /css/elegant-icons.css HTTP/1.1" 404 2099
[02/Aug/2020 04:34:09] "GET /css/slicknav.min.css HTTP/1.1" 404 20
"""

I also tried STATICFILES_URL but its not working , please help I'm going crazy
i have also try collectstatic but nothing happens , i dont understand the problem please help

A:

Can you try placing css files under Gym/static/Gym/#place css files here
and in index.html use below
<link rel="stylesheet" href="{% static 'Gym/bootstrap.min.css' %}" type="text/css">

