I know this has been asked hundreds of times over the years here, here, here (and others) but I can't load my css files from my static folder.
- Django 1.7
- Python 2.7
My command line says
[07/Apr/2016 10:56:13] "GET / HTTP/1.1" 200 3596
[07/Apr/2016 10:56:13] "GET /static/compile/css/fbparse.min.6d40ca4cc832.css HTTP/1.1" 200 64
[07/Apr/2016 10:56:13] "GET /static/compile/js/fbparse.min.b40ef3f82f3a.js HTTP/1.1" 200 64
However, my log file says
2016-04-07 10:45:14,333 [WARNING] django.request: Not Found: /static/compile/css/fbparse.min.6d40ca4cc832.css
2016-04-07 10:56:13,848 [WARNING] django.request: Not Found: /static/compile/css/fbparse.min.6d40ca4cc832.css
2016-04-07 10:56:13,852 [WARNING] django.request: Not Found: /static/compile/js/fbparse.min.b40ef3f82f3a.js
And of course, the site does not load the css file.
When I try
http://127.0.0.1:8000/static/compile/css/fbparse.min.6d40ca4cc832.css
It gives me error 404
Here is what I have in settings file
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
rel = lambda *x: os.path.join(BASE_DIR, *x)
DEBUG = False
MEDIA_ROOT = rel('public', 'media')
MEDIA_URL = '/media/'
STATIC_ROOT = rel('public', 'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
rel('static_src'),
)
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
.....
)
Here is what I have in the Base html
<!DOCTYPE html>
{% load pipeline static i18n stats_tags %}
<html>
<head>
<meta charset=utf-8 />
<title>My site title</title>
{% stylesheet 'global' %}
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
{% javascript 'global' %}
{% if debug %}
<script src="{% static "components/less.js/dist/less.min.js" %}"></script>
{% if LESS_DEBUG %}
<script type="text/javascript">
less.env = "development";
less.watch();
</script>
{% endif %}
{% endif %}
</head>
I have tried putting the static folder in the root directory, inside public, inside static_src but nothing seems to work.
Can anyone tell me what I am doing wrong?