Thanks for your comments: Here are the changes I've made, and it still does not load:
A directory css is under the main media directory a...@h2oamr:~/django/amr$ ls -l media/css total 4 -rw-r--r-- 1 amr amr 72 Nov 30 14:45 amr.css Here are the settings.py changes: # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '/home/amr/django/media/' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = '/media/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/media/' ROOT_URLCONF = 'amr.urls' STATIC_DOC_ROOT = '/home/amr/django/media' And here's the reference to it in the 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="css/amr.css" /> </head> On Dec 1, 4:51 am, Tom Evans <tevans...@googlemail.com> wrote: > On Tue, Nov 30, 2010 at 6:21 PM, octopusgrabbus > > <old_road_f...@verizon.net> wrote: > > 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> > > So you are requesting the file '/static_media/amr.css' > > > > > 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'}), > > and you are enabling file serving from a path starting '/site_media/' > (assuming this is your root urlconf). > > Is it clear why it isn't working now? 'site_media' != 'static_media'. > > In your django dev console, it shows each URL requested, and the HTTP > return code. It will look something like this: > > [01/Dec/2010 09:38:47] "GET /static_media/amr.css HTTP/1.1" 404 2572 > > The first part ('/static_media/') has to match the URL you put in your > urlconf, and the second part ('amr.css') must exist in the folder that > you specify as document_root (or subfolder etc). > > This isn't exactly rocket science, just make everything match up, and it > works. > > BTW, in your template you can use {{ MEDIA_URL }} to get the prefix to > your media - assuming you have correctly set settings.MEDIA_URL, and > have django.core.context_processors.media in > TEMPLATE_CONTEXT_PROCESSORS and use a RequestContext to render with, > which is a few caveats I guess :) > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.