WebFaction
Community site: login faq

Django Admin isn't locating the required CSS files.

I've set this up correctly in the past but this time can't seem to get it right.

ADMIN_MEDIA_PREFIX = posixpath.join(STATIC_URL, "/media/")
STATIC_URL = '/site_media/'
MEDIA_URL = '/site_media/media/'
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'site_media', 'media')

Created symbolic link to point to: /home/user/webapps/app/lib/python2.6/django/contrib/admin/media

I'm a bit tired so I'm probably missing an obvious piece.

<link rel="stylesheet" type="text/css" href="/media/css/base.css" /> shows as not a valid link when clicked from source.

asked 05 Jan '11, 21:07

pythondjango
161810
accept rate: 0%

edited 05 Jan '11, 22:50


Check the link to the CSS in the HTML source with your browser to make sure it is a valid link. Also login via SSH and run,

$ ls ~/webapps/

To verify the symbolic link is valid, it will be green if it is and red if it is not.

permanent link

answered 05 Jan '11, 21:19

johns
5.4k312
accept rate: 23%

Link showed as green. When I check the .css file from the html source, it is not a valid link.

(05 Jan '11, 22:47) pythondjango

Hi,

<link rel="stylesheet" type="text/css" href="/media/css/base.css"/>

Looks like it is the wrong URL to access your media. Can you try:

<link rel="stylesheet" type="text/css" href="/site_media/media/css/base.css"/>

or use {{ MEDIA_ROOT }}/css/base.css so that if you change the paths in the future it doesn't break your site.

(05 Jan '11, 22:54) klynton

Klynton, Received a 404 error at that modified URL: /site_media/media/css/base.css Thanks

(05 Jan '11, 23:08) pythondjango

Hi,

Can you submit a support ticket or provide a URL that we can see the problem happening so that we can look into it further?

(05 Jan '11, 23:11) klynton
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

question asked: 05 Jan '11, 21:07

question was seen: 6,634 times

last updated: 05 Jan '11, 23:11

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