I am using Django and I can't get my style.css to work. Every time I load the page I am working on, no css is applied. Also I get this in the terminal "GET /css/style.css HTTP/1.1" 404 2239
My style.css is located in .../Templates/site_media/static/css
I also have djago.contrib.staticfiles in my INSTALLED_APPS
I have this in my settings.py
STATIC_URL = '/static/'
STATICFILES_DIRS = "/Templates/site_media/",
This is what I have in my template to load the css
<link href="{{STATIC_URL}}css/style.css" rel="stylesheet" type="text/css" >
My style.css is located in
.../Templates/site_media/static/css
doesnt match
<link href="{{STATIC_URL}}css/style.css" rel="stylesheet" type="text/css" >
you would need to have your link as:
<link href="{{STATIC_URL}}static/css/style.css" rel="stylesheet" type="text/css" >
Edit Use absolute paths for STATICFILES_DIRS (thx Yuji):
settings.py:
import os
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
STATIC_URL = '/static/'
STATICFILES_DIRS = ((os.path.join(SITE_ROOT,'Templates/site-media'),)
make sure that your:
TEMPLATE_CONTEXT_PROCESSORS
has 'django.core.context_processors.static',