django导入css

Posted on 2011-12-02 21:40  仆本浪人  阅读(749)  评论(1编辑  收藏  举报

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