Django Admin CSS missing
Solution 1:
Django recommends that you deploy static files with a web server other than wsgi.
- In settings.py, set:
STATIC_ROOT = 'static'
Run
python manage.py collectstatic
, which will copy the Django admin static files to/path/to/project/static/
-
Configure your static file server. If you use Nginx, you could add this config:
location /static/ { alias /path/to/project/static/; expires modified +1w; }
Reload your web server
You should now have access to the static files.
Solution 2:
In Django 1.4 ADMIN_MEDIA_PREFIX
is deprecated. Here are the steps I followed to catch up with these somewhat recent Django changes:
in
settings.py
, adddjango.contrib.staticfiles
toINSTALLED_APPS
in
settings.py
defineSTATIC_URL
— the staticfiles app won't run without it. While usingrunserver
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.