1

If I use the code below it will find my base.css under the project folder:

<link rel="stylesheet" type="text/css" href="{% block stylesheet %}/media/a/admin/css/base.css{% endblock %}" />

MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media')
MEDIA_URL = '/media/a/'
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),

However, if I use the code below, it will go to the \Python25\Lib\site-packages\django\contrib\admin\media\css to find base.css:

<link rel="stylesheet" type="text/css" href="{% block stylesheet %}/a/admin/css/base.css{% endblock %}" />

MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'media')
MEDIA_URL = '/a/'
(r'^a/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),

Does anyone know the reason why this happens?

Thanks~~

2 Answers 2

1

I'm guessing you have your ADMIN_MEDIA_PREFIX = '/a/admin/'

http://docs.djangoproject.com/en/dev/ref/settings/#admin-media-prefix

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).

Sign up to request clarification or add additional context in comments.

Comments

0

my mistake:

i haven't set the "runsever --adminmedia" command

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.