I finally got my django install working, however I'm noticing that the typical look and feel of the admin pages are missing, and it's as if there are no styles applied to the structure of the pages. Do I have some kind of setup issue or pathing issue that's preventing the style sheets from being found? Where are they stored? My pages look like they are from 1994.
-
Is this on your local machine (runserver) or on remote host?– TomJul 17, 2010 at 13:53
-
Do you use a serious Web server or the dev server (manage.py runserver) ? If first anwser, which one (apache, cherokee, lighttp) ?– e-satisJul 17, 2010 at 14:08
-
Using apache on localhost with ubuntu 10.04 server.– RhubarbJul 17, 2010 at 21:43
-
Thumbs up only for "My pages look like they are from 1994"– DanielJan 3, 2020 at 6:04
3 Answers
Sounds like your admin media isn't being served correctly. In your settings.py
, there's a variable called ADMIN_MEDIA_PREFIX
, which specifies the URL where Django should look for them. The actual media files are in "[path to your Python site-packages]/django/contrib/admin/media". When using manage.py runserver
, the files are served "automagically". However, when using Apache/nginx/etc it's your responsibility to make sure that your server makes the files available at that URL (using rewrite rules, symlinks, etc). More info can be found here.
-
-
3Updated link: docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/… Nov 14, 2015 at 0:46
I've solved this issue simply with the alias on apache:
Alias /static/admin/ /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/
Alias admin/media/ /usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/
You need to provide more info for use to help you properly. However, this is most probably because didn't set up your Web server to serve static file, and therefor, the admin CSS is not loaded.
To solve this, got the the admin and look at the HTML source. You'll css the path to the admind css. Make your web server service this file on this path.