Wade
Wade

Reputation: 113

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 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" />

Upvotes: 1

Views: 1662

Answers (1)

AndiDog
AndiDog

Reputation: 70128

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" />
        ^^^

Upvotes: 1

Related Questions