Tuesday, November 30, 2010

Loading CSS

I am running Django 1.2.3 -- python -c "import django; print
django.get_version()" I basically need to know what logs to look at to
fix a css file not loading.

I am trying to load a css file in my base template

<html>
<!-- Test Comment -->
<head>
<title>{% block title %}Town of Arlington Water Department AMR
System{% endblock %} </title>
<link rel="stylesheet" type="text/css" href="/static_media/
amr.css" />
</head>

Here's the css file -- you could say it's a "test file".

body{ background-color: gray;}
p { color: blue; }
h3{ color: white; }

In urls.py this is inserted into

urlpatterns = patterns('',

(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': '/home/amr/django'}),

Nothing loaded. Then, I tried setting STATIC_DOC_ROOT = '/home/amr/
django/static_media' in settings.py and in urls.py

from django.conf import settings
...
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_DOC_ROOT}),

and gotten this error

AttributeError at /

'Settings' object has no attribute 'STATIC_DOC_ROOT'

Thanks for any help or pointers.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment