python - why i can't use django admin app's resource -
i want reuse django's contrib "admin" resource in project, "admin" has static directory, "static/admin/image/selector-icons.svg" want reuse.
i have such settings.py:
staticfiles_finders = ( 'django.contrib.staticfiles.finders.filesystemfinder', 'django.contrib.staticfiles.finders.appdirectoriesfinder', )
i tried:
staticfiles_dirs = ( os.path.join(project_root,'static'), file path of admin's static )
failed again.
"admin" can use "static/admin/image/selector-icons.svg" in "widgets.css" like
.selector-add { background: url(../img/selector-icons.svg) 0 -96px no-repeat; cursor: default; }
but cant in project this:
.selector-add { background: url(admin/img/selector-icons.svg) 0 -96px no-repeat; cursor: default; }
console of chrome said 404 error!
.selector-add { background: url(admin/img/selector-icons.gif) 0 -96px no-repeat; cursor: default; }
worked.
and find in "admin" render html, "selector-icons.svg" transform "selector-icons.gif", below picture:
so question is:
first: how reuse "admin" resource?
second:why "selector-icons.svg" "selector-icons.svg"?
the icons have been changed svg in django 1.9, hasn't been released yet (see ticket 20597).
on older versions of django, including current release 1.8, icons gifs.
you either use gifs until upgrade, or if need svgs now, clone repository , add the svgs static files.
Comments
Post a Comment