tags:

views:

24

answers:

1

I tried to customize django's admin css....but I'm stuck ....i did find a lot of similar discussions here...still I'm not clear... here is what I see...

In base.html, we have

<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base.css{% endblock %}"

the line resolves to

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

in the installed admin, base.html is originally located in

C:\Python27\Lib\site-packages\django\contrib\admin\templates\admin

to customize the admin app, I copied admin\templates\admin to my project templates directory. And then I copied all the C:\Python27\Lib\site-packages\django\contrib\admin\media to my project as PROJECT_ROOT\media.

I hope

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

will use PROJECT_ROOT\media\ for css.....

However, django still uses C:\Python27\Lib\site-packages\django\contrib\admin\media ....

could some one explain why?

Further, what I need to do to let href="/media/css/base.css" use PROJECT_ROOT\media\?

thanks.

A: 

Make sure that the URL for your admin media is configured in the settings for ADMIN_MEDIA_PREFIX:

ADMIN_MEDIA_PREFIX

Default: '/media/'

The URL prefix for admin media -- CSS, JavaScript and images used by the Django administrative interface. Make sure to use a trailing slash, and to have this be different from the MEDIA_URL setting (since the same URL cannot be mapped onto two different sets of files).

Also, if you're using django's development server, see the docs on How to serve static files:

If you just need to serve the admin media from a nonstandard location, see the --adminmedia parameter to runserver.

ars