我有我的网址模式,
urlpatterns += patterns('',
(r'^(?P<path>.*)$', 'django.views.static.serve',
{'document_root': '/home/tipu/Dropbox/dev/workspace/search/images'})
当我这样做时,在我的模板中
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}style.css" />
它为 css 服务就好了。但是,与 style.css 位于同一目录中的文件 logo.png 在我执行此操作时不会显示:
<img src = "{{ MEDIA_URL }}logo.png" id = "logo" />
知道为什么吗?
编辑:
它们位于同一目录中:http: //i.imgur.com/Wlssb.png
root@tipu_ubuntu:/home/tipu/Dropbox/dev/workspace/search# curl -I http://localhost:8080/logo.png
HTTP/1.1 404 Not Found
Date: Sun, 30 May 2010 19:56:54 GMT
Server: Apache/2.2.14 (Ubuntu)
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=iso-8859-1
root@tipu_ubuntu:/home/tipu/Dropbox/dev/workspace/search# curl -I http://localhost:8080/style.css
HTTP/1.1 200 OK
Date: Sun, 30 May 2010 19:57:06 GMT
Server: Apache/2.2.14 (Ubuntu)
Last-Modified: Thu, 27 May 2010 03:28:14 GMT
Content-Length: 1447
Content-Type: text/css
Vary: Accept-Encoding
Connection: close