Django Admin CSS missing

I'm using Django 1.4.3

What did NOT work for me: No matter how much I edited ADMIN_MEDIA_PREFIX in settings.py I noticed no change in the HTML generated for the Django Admin pages. It always says /media/admin/base.css when I view the source.

What DID work for me. Copied the 'admin' folder from /django/contrib/admin/static/ and pasted it into my projects 'media' folder

Now it works great.


Django recommends that you deploy static files with a web server other than wsgi.

  1. In settings.py, set:

STATIC_ROOT = 'static'

  1. Run python manage.py collectstatic, which will copy the Django admin static files to /path/to/project/static/

  2. Configure your static file server. If you use Nginx, you could add this config:

    location /static/ {                              
        alias /path/to/project/static/;  
        expires modified +1w;                        
    }  
    
  3. Reload your web server

You should now have access to the static files.


It seems dumb, but I actually had this exact issue and the solution was to set DEBUG=False to DEBUG=True on my local dev environment. When debug is set to False, it thinks it's in a production environment which relies on a place to put static files, such as /var/www/html/static, whereas the debug set to True just uses the local directory.


In Django 1.4 ADMIN_MEDIA_PREFIX is deprecated. Here are the steps I followed to catch up with these somewhat recent Django changes:

  1. in settings.py, add django.contrib.staticfiles to INSTALLED_APPS

  2. in settings.py define STATIC_URL — the staticfiles app won't run without it. While using runserver they'll get handled magically, but when you deploy, this needs to be a location where those resources can be fetched by a browser.

I think that's all there was to it.