4

I'm getting some really weird issues with the Django admin application. I'm running everything on the manage.py runserver development server, so I can't imagine what the issue would be, but I'm seeing something like this:

enter image description here

Obviously, this isn't ideal, so I'd like to return it to actually looking good. I'm using the staticfiles app, which I think might be a part of the problem, but I don't know for sure. What am I doing wrong here?

The admin site seems to link to the following CSS sheets, which aren't being found:

<link rel="stylesheet" type="text/css" href="/media/css/base.css" />
<link rel="stylesheet" type="text/css" href="/media/css/dashboard.css" />
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411

3 Answers3

3

I'm assuming you mean you're using the staticfiles contrib package in Django 1.3. If that's correct, you only need:

ADMIN_MEDIA_PREFIX = STATIC_URL+'admin/'
Chris Pratt
  • 232,153
  • 36
  • 385
  • 444
2

In settings.py uncomment(if commented) or add 'django.contrib.staticfiles', and restart the server. This should fix it.

Vineeth Chitteti
  • 1,454
  • 2
  • 14
  • 30
1

You've probably got your ADMIN_MEDIA_PREFIX set incorrectly.

Try setting it to:

ADMIN_MEDIA_PREFIX = "/admin-media/"

And see if that fixes everything.

Ok, three more things to check:

  1. Just a sanity check: are the admin stylesheets which are 404ing actually prefixed with /admin-media/?
  2. Is there any chance that your custom URL handlers are matching? (ex, do you have something like url(r'^admin-media/', …) in your root urls.py?
  3. It's unlikely, but is there any chance your Django install could be broken? do the .css files actually exist in …/site-packages/django/contrib/admin/static/admin?
David Wolever
  • 148,955
  • 89
  • 346
  • 502