title: django file style.css cannot be found
body: <p>My css is failing. no css commands initialize in my templates page.
  django shows no errors in it but in the apache logs I see that the stlye.css cannot be found, even with a static path.</p>
  
  <pre><code>[wsgi:error] [pid 25372] [remote 73.135.97.117:47050] Not Found: /home/robin/www/trader/templates/trader/style.css
  </code></pre>
  
  <p>but the file is very much there. I tried permission 644 and 777 to the style.css file</p>
  
  <pre><code>root@localhost:/home/robin/www/trader# ls -l /home/robin/www/trader/templates/trader
  total 12
  -rw-r--r-- 1 www-data www-data 2905 May 13 14:26 index.html
  -rwxrwxrwx 1 www-data www-data  155 May 13 12:46 style.css
  </code></pre>
  
  <p>My apache directive looks normal</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
          ServerName coinz.com
          ServerAdmin webmaster@coinz.com
          DocumentRoot /home/robin/www/
  
          ErrorLog ${APACHE_LOG_DIR}/error.log
          CustomLog ${APACHE_LOG_DIR}/access.log combined
          WSGIDaemonProcess trader python-path=/home/robin/www/trader/:/usr/lib/python3/dist-packages/
          WSGIProcessGroup trader
          WSGIScriptAlias / /home/robin/www/trader/trader/wsgi.py
  
          &lt;Directory /home/robin/www/trader/&gt;
                  &lt;Files wsgi.py&gt;
                          Require all granted
                  &lt;/Files&gt;
          &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>settings.py</p>
  
  <pre><code>root@localhost:/home/robin/www/trader# cat trader/settings.py 
  
  import os
  
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  SECRET_KEY = 'xxx'
  DEBUG = True
  
  ALLOWED_HOSTS = ['coinz.com']
  
  
  # Application definition
  
  INSTALLED_APPS = [
          'trader',
          'buy',
          'sell',
          'manager',
          'django.contrib.admin',
          'django.contrib.auth',
          'django.contrib.contenttypes',
          'django.contrib.sessions',
          'django.contrib.messages',
          'django.contrib.staticfiles',
  ]
  
  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 = 'trader.urls'
  
  TEMPLATES = [
      {
          'BACKEND': 'django.template.backends.django.DjangoTemplates',
          'DIRS': ['/home/robin/www/trader/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 = 'trader.wsgi.application'
  
  DATABASES = {
          'default': {
                  'ENGINE': 'django.db.backends.mysql',
                  'NAME': 'xxx',
                  'USER': 'xxx',
                  'PASSWORD': 'xxx',
                  'HOST': '127.0.0.1',
                  'PORT': '',
          }
  }    
  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',
      },
  ]
  
  
  LANGUAGE_CODE = 'en-us'
  
  TIME_ZONE = 'UTC'
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True    
  
  STATIC_URL = '/static/'
  </code></pre>
  
  <p>How do I get django to find my style.css?</p>
  
  <p>UPDATE:
  html </p>
  
  <pre><code>&lt;head&gt;
  {% load static %}
  &lt;link rel="stylesheet" type="text/css" href={% static "style.css" %}&gt;
  
  &lt;/head&gt;
  </code></pre>
  
  <p>and added to settings.py</p>
  
  <pre><code>STATICFILES_DIRS = [
          os.path.join(BASE_DIR, "static"),
          '/home/robin/www/trader/templates/trader/',
  ]
  </code></pre>
  
  <p>adding urls.py</p>
  
  <p>root@localhost:/home/robin/www/trader# cat trader/urls.py </p>
  
  <pre><code>from django.contrib import admin
  from django.urls import path
  from django.conf.urls import url, include
  from . import views
  from django.conf import settings
  from django.conf.urls.static import static
  app_name = 'trader'
  urlpatterns = [
          path('', views.index, name='index'),
          path('admin/', admin.site.urls),
          url(r'^buy/', include('buy.urls')),
  ]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
  </code></pre>
  
  <p>also tried:</p>
  
  <pre><code>root@localhost:/home/robin/www/trader# python3 manage.py findstatic templates/trader/style.css 
  No matching file found for 'templates/trader/style.css'.
  
  
  root@localhost:/home/robin/www/trader# ls -l templates/trader/style.css
  -rw-r----- 1 www-data www-data 155 May 13 12:46 templates/trader/style.css
  </code></pre>
  
  <p>also tried:</p>
  
  <p>chmod 0644 and 0655 for styles.css (in all directories and STATIC_URL combinations), same nah-dah.</p>