WebFaction
Community site: login faq

I was working on creating a Django project, and was having a problem with the media for the admin site not being displayed properly. (When I went to the admin page, it worked fine but the page was plain, missing all the css and js.) It was driving me crazy and I couldn't figure out what was wrong, so I just deleted the whole project and started again, following the Django tutorial webcast step-by-step. And I'm still having the same problem! I can't figure it out...

Here's the media settings from settings.py: MEDIA_ROOT = '/home/username/webapps/static_media' MEDIA_URL = 'http://mysite.com/media/' ADMIN_MEDIA_PREFIX = 'http://mysite.com/media/admin/'

Any ideas?

~Karen

asked 08 Jan '11, 20:39

Karen McNeil
16246
accept rate: 0%


Hi Karen,

Try changing your ADMIN_MEDIA_PREFIX from

ADMIN_MEDIA_PREFIX = 'http://mysite.com/media/admin/'

to

ADMIN_MEDIA_PREFIX = '/media/admin/'

and make sure that in the control panel you have the admin symbolic link application mounted at /media/admin.

Regards,

Klynton J. WebFaction Support -- WebFaction - Smarter web hosting http://webfaction.com - http://twitter.com/webfaction

permanent link

answered 08 Jan '11, 20:42

klynton
1.6k1210
accept rate: 41%

I made that change in the ADMIN_MEDIA_PREFIX and it didn't fix it...

(I double checked and the symbolic link app is mounted at /media/admin in the website panel.)

Any other suggestions?

(08 Jan '11, 22:16) Karen McNeil

By the way, I was reading your response to a related question, and tried the things you suggested there. When I check ls ~/webapps/, the admin_media app is blinking red. (And the link in the source is, of course, invalid.)

Thanks, Karen

(08 Jan '11, 22:24) Karen McNeil

Hi Karen,

In that case you should remove that symlink application and create a new one with the full path to the admin media again so it isn't blinking red and it should work for you.

(08 Jan '11, 22:37) klynton

I did that, and the app was still blinking red. So I tried different permutations of the origin path for the symlink, and the one that finally worked was:

/home/username/webapps/django_app/lib/python2.6/django/contrib/admin/media

The '/' at the beginning is what changed. The tutorial doesn't have that slash, and my projects use to work without it.

Did something change?

(09 Jan '11, 07:49) Karen McNeil

Our documentation is definitely wrong there. I'll make a note to have it updated ASAP.

That slash is always required, otherwise it's treated as a relative symlink, which would result in

/home/<username>/webapps/home/<username>/webapps/django_app/lib/python2.6/django/contrib/admin/media
(09 Jan '11, 08:23) David L ♦♦

Just FYI, the documentation has now been corrected :)

Sorry about that!

(09 Jan '11, 09:30) David L ♦♦
showing 5 of 6 show 1 more comments

Or add these two lines to your httpd.conf

LoadModule alias_module      modules/mod_alias.so
Alias /admin_media/ "/home/<username>/webapps/django/lib/python2.6/django/contrib/admin/media/"

You might need to check that your copy of django is in lib "python2.6", not "python2.5".

permanent link

answered 20 Jan '11, 16:53

johnm
113
accept rate: 0%

edited 20 Jan '11, 16:54

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×40
×26
×17

question asked: 08 Jan '11, 20:39

question was seen: 5,479 times

last updated: 20 Jan '11, 16:54

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM