开发者

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

开发者 https://www.devze.com 2023-02-15 07:08 出处:网络
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

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

精彩评论

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

关注公众号