Why does my Django admin site not have styles / CSS loading?
Solution 1:
After setting up your STATIC_ROOT
and STATIC_URL
, you may have to run
python manage.py collectstatic
Solution 2:
ADMIN_MEDIA_PREFIX
is deprecated now, use STATIC_URL
instead. Setting STATIC_URL = '/static/'
in settings.py should do the job. Try:
import os.path
import sys
PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__))
and then:
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
STATIC_URL = '/static/'
Works on Django 1.4 pre-alpha SVN-16920.
Solution 3:
Django does not serve static files on it's own. You have to tell it where the files are.
The ADMIN_MEDIA_PREFIX in the settings.py will point Django in the right location.
Since you're using the development version, you'll want the dev-specific document for static files how-to. Adam's link will lead you to the 1.2 version.