开发者

Using static CSS files in Django 1.2.3 (Using Development Server)

First time Django user. VERSION: 1.2.3

I am trying to set up my dev server to use static CSS files, but开发者_如何学C can't seem to get the settings quite right. I've looked at the Django documents and other threads here, but still no luck. I'm hopping another set of eyes will help me.

Here's what I'm using right now:

settings.py

DEBUG = True
MEDIA_ROOT = '/home/wade/myproject/static/'
MEDIA_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/media/'

TEMPLATE_LOADERS = (

'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
)

TEMPLATE_DIRS = (

'/home/wade/myproject/templates',
)

urls.py

from django.conf import settings

if settings.DEBUG:
urlpatterns += patterns('',
    (r'^static/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT}),
)

.html

<link rel"stylesheet" type="text/css" 
    href="/static/style.css" />


So, since your CSS file did load, I looked at your question again and found that you're just missing a = in your HTML.

<link rel"stylesheet" type="text/css" href="/static/style.css" />
        ^^^
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜