html - Django bower, bootstrap, staticfiles doesn't work -
i have problem loading static files django template.
here settings:
installed_apps = ( 33 'django.contrib.admin', 34 'django.contrib.auth', 35 'django.contrib.contenttypes', 36 'django.contrib.sessions', 37 'django.contrib.messages', 38 'django.contrib.staticfiles', 39 'chat', 40 'ws4redis', 41 'djangobower', 42 ) 44 middleware_classes = ( 45 'django.contrib.sessions.middleware.sessionmiddleware', 46 'django.middleware.common.commonmiddleware', 47 'django.middleware.csrf.csrfviewmiddleware', 48 'django.contrib.auth.middleware.authenticationmiddleware', 49 'django.contrib.auth.middleware.sessionauthenticationmiddleware', 50 'django.contrib.messages.middleware.messagemiddleware', 51 'django.middleware.clickjacking.xframeoptionsmiddleware', 52 ) 54 root_urlconf = 'chrum.urls' 68 static_root = os.path.join(base_dir, 'static') 70 staticfiles_finders = ("django.contrib.staticfiles.finders.filesystemfinder", 71 'django.contrib.staticfiles.finders.appdirectoriesfinder', 72 'djangobower.finders.bowerfinder',) 73 staticfiles_dirs = ( 74 os.path.join(base_dir, "components"), 75 ) 77 bower_components_root = os.path.join(base_dir, 'static') 78 bower_installed_apps = ('bootstrap',)
heres template:
4 {% load staticfiles %} 5 {% load static staticfiles %} 6 <script src="{% static 'components/bower_components/jquery/dist/jquery.js' %}"></script> 7 <script src="{% static 'components/bower_components/bootstrap/dist/js/bootstrap.js' %}"></script> 8 <script rel="stylesheet" type="text/css" src="{% static 'components/bower_components/bootstrap/dist/css/bootstrap.css' %}"></script>
in site source, can see link works, , can read css file.
server returns:
[05/dec/2014 21:45:52] "get /static/components/bower_components/jquery/dist/jquery.js http/1.1" 304 0 [05/dec/2014 21:45:52] "get /static/components/bower_components/bootstrap/dist/js/bootstrap.js http/1.1" 304 0 [05/dec/2014 21:45:52] "get /static/components/bower_components/bootstrap/dist/css/bootstrap.css http/1.1" 304 0
but css doesnt work, , can't see in style editor in browser.
ps: if import css file in browser manually works!
it seems haven't defined static_url
variable in settings.py file. add following lines settings:
static_url = '/static/'
Comments
Post a Comment