1. settings中设置一变量获取绝对路径:PROJECT_PATH = os.path.dirname(globals()["__file__"])
2. urls中设置资源路径规则:
urlpatterns = patterns('',
# Examples:
url(r'^statics/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.PROJECT_PATH+'/statics'})
}
3. 模板中引用资源文件:
<link rel="stylesheet" href="statics/css/noobSlide.css" type="text/css" media="screen" />
<script type="text/javascript" src="statics/js/noobSlide/mootools-1.2-core.js"></script>
<script type="text/javascript" src="statics/js/noobSlide/_class.noobSlide.packed.js"></script>