[Fixed]-Django1.9 does not load css from static admin

1👍

✅

You have to set STATIC_ROOT, STATIC_URL and STATICFILES_DIRS in settings.py as below:

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

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

and then try to run:

python manage.py collectstatic

0👍

If you are using django-rest-framework see this.

You need to add it as,

INSTALLED_APPS = (
    ...
    'rest_framework',
)

and in urls.py:

urlpatterns = [
    ...
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]

It will automatically search and catch all the static files.

Leave a comment