【发布时间】:2015-01-05 16:05:48
【问题描述】:
在我的 settings.py 中,我有这样的静态设置:
STATIC_ROOT = ' '
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
我的项目结构是:
ProjectName
app1
app2
ProjectName
static
css
js
images
我在 style.css 中写了一个 css :
input.search { width: 279px; border: none; background: #fff url(../images/input.gif) no-repeat; padding: 6px 10px; color: #1E67A8; font-weight: bold; }
当我这样做时,它没有显示我在 style.css 中分配的图像..
什么问题??
【问题讨论】:
-
告诉你是否可以通过 url 访问它...? localhost:8000/static/images/input.gif
-
是的,图片是从提到的网址访问的......
-
然后在 css 中做同样的事情 .. 见下面我的答案
标签: css django templates static