开发者

django-staticfiles breaking the admin interface

开发者 https://www.devze.com 2023-02-13 17:42 出处:网络
I\'m using the django-staticfiles app to serve css files, but this also prevents required admin css files (media/base.css, media/dashboard.c开发者_高级运维ss) from being loaded. It seems like I need t

I'm using the django-staticfiles app to serve css files, but this also prevents required admin css files (media/base.css, media/dashboard.c开发者_高级运维ss) 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',

)


(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.

0

精彩评论

暂无评论...
验证码 换一张
取 消