rlayte
rlayte

Reputation: 538

django-staticfiles breaking the admin interface

I'm using the django-staticfiles app to serve css files, but this also prevents required admin css files (media/base.css, media/dashboard.css) from being loaded. It seems like I need to exclude the admin app, but adding it to the STATICFILES_EXCLUDED_APPS hasn't helped.

Here are the relevant bits from my settings.py file:

ADMIN_MEDIA_PREFIX = '/media/'

...

STATIC_URL = '/static/'
STATIC_ROOT = ''
STATICFILES_EXCLUDED_APPS = (
    'django.contrib.admin',
)

INSTALLED_APPS = (
    ...

    'django.contrib.admin',
    'staticfiles',

)

Upvotes: 4

Views: 1827

Answers (1)

Richard Nienaber
Richard Nienaber

Reputation: 10564

(I'll assume this is for development as you shouldn't serve static content with django-staticfiles.)

You have to define the ADMIN_MEDIA_ROOT variable in your settings.py file and point it to the location of the admin css files. I've moved these files out of site-packages to be in a similar location as my other static files for ease of deployment.

Upvotes: 4

Related Questions