settings.py
MEDIA_ROOT = '/home/lotus/django/myblog/css'
MEDIA_URL = '/statics/'
STATIC_ROOT = '/home/lotus/django/myblog'
STATIC_URL = '/static/'
urls.py
if settings.DEBUG:
urlpatterns += patterns('',
(r'^statics/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
)
inside templates:
<link rel="stylesheet" type="text/css" href="/statics/style.css" />`
本地目录:
django--myblog--blog(app)
--css----style.css
--templates-----archive.html