Django Admin Page missing CSS Django Admin Page missing CSS django django

Django Admin Page missing CSS


In addition to correcting the symbolic link as Daniel Roseman suggested, you'll need to make sure that the user that is running Apache has read access to the admin media.

  • If you do ls -l in your media directory, do you see the symbolic link?
  • If you cd admin from your media directory, does it work? If you then run ls can you see the admin media?
  • Does the user that runs Apache have read access to the admin media?

If all those things work, then please update your question with your current configuration and results of those commands and we'll take another look.

Response to Update: Ok, the permissions look ok. It looks like you've got the directory structure in your media directory a little bit wrong.

The fact that /usr/lib/python2.6/site-packages/django/contrib/admin/media/ was empty is disturbing, too. Once you solve the immediate problem you may want to look into reinstall django in the expected place.

Anyways, here's how the structure should look:

$ cd media$ ls -ladrwxr-xr-x 2 root root 4096 Apr 13 03:33 .drwxr-xr-x 3 root root 4096 Apr  8 09:02 ..lrwxrwxrwx 1 root root   60 Apr 13 03:33 admin -> /usr/lib/python2.6/site-packages/django/contrib/admin/media/-rw-r--r-- 1 root root    9 Apr  8 09:02 test.txt

That is, inside of the media/ directory their should be a link called admin directly to the /admin/media directory of your django installation.

To fix what you've got, inside of the media/admin/ directory run:

rm mediacd ..rmdir admin

and then re-create the symlink as suggested in Daniel Roseman's answer.


There's a couple of problems here, both to do with your symbolic link.

Firstly, the source and target needed to be the other way round (I always get that wrong myself).

Secondly, you have used a completely different path to the one you've specified in your Apache conf - djangotest/sgelections vs django/sgel.

Do it like this:

cd /home/django/sgel/media/ln -s /usr/lib/python2.6/site-packages/django/contrib/admin/media/ admin


The easy solution is to change a line in your wsgi.py file

    from django.core.wsgi import get_wsgi_application    application = get_wsgi_application()

becomes

    from django.core.wsgi import get_wsgi_application    from dj_static import Cling    application = Cling(get_wsgi_application())

Easiest way to have the Admin CSS show properly. Cheers