静态文件的引用,
1.url: url(r'^templates/site_media/(?P<path>.*)$','django.views.static.serve',
{'document_root': WebMessageBoard.settings.STATICFILES_DIRS,
'show_indexes': True})
templates/site_media/:是静态文件所在路径
2.<link rel="stylesheet" href="/templates/site_media/style.css" type="text/css">
重点是要将href的地址与URL中的地址对应起来,所以当你的link中的href是:
<link rel="stylesheet" href="/site_media/style.css" type="text/css">
你的URL应该是:
url(r'^site_media/(?P<path>.*)$','django.views.static.serve',
{'document_root': WebMessageBoard.settings.STATICFILES_DIRS,
'show_indexes': True}),
实质是要让服务器通过href的连接找到这个连接对应 处理静态文件的试图函数
PS:css文件中:.是class
#是id