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~~
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).
my mistake:
i haven't set the "runsever --adminmedia" command
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.