[Answer]-Django doesn't load css files

1👍

In your urls.py file,

from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = patterns('',
    url(r'^$', include('frontend.urls')),
);

urlpatterns += static(settings.STATIC_URL,document_root=settings.STATIC_ROOT)

Make sure that your settings.py file has these defined.

BASE_DIR = os.path.dirname(os.path.dirname(__file__))

STATIC_URL = '/static/'

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

STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
)

Also, in your templates add on the top:

{%load staticfiles%}

These settings work for me.

Leave a comment