Hey,

I just started working with Django, and don't want to deal with
setting up Apache or anything else on my development box for static
content.  I found the following page for setting up Django to serve
static content during development:

http://www.djangoproject.com/documentation/0.96/static_files/

I'm using the 0.96 docs instead of current because I'm using 0.96
(latest Ubuntu package).  As far as I can tell, this page isn't
different between 0.96 and the latest version.

As it suggested, I put

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

in my URLconf.  I'll deal with the debug-mode-only stuff later, and I
did change /path/to/media to the appropriate location.

In a template, I reference a CSS file as "site_media/style.css" with
interesting results.  If I hit the URL for the file directly,
http://localhost:8000/site_media/style.css, it works (using manage.py
runserver for the server).  If I load a page based on the template
which refers to the CSS file, it fails to find the CSS file.  Watching
the output from the server in the terminal, I see:

Validating models...
0 errors found.

Django version 0.96, using settings 'papers.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[25/Feb/2008 00:35:58] "GET /site_media/syle.css HTTP/1.1" 304 0
[25/Feb/2008 00:36:03] "GET / HTTP/1.1" 200 1174
[25/Feb/2008 00:36:03] "GET /site_media/style.css HTTP/1.1" 404 131

The first style.css hit is a direct hit, the second is from hitting
the view whose template refers to style.css.  The direct hit serves up
the file correctly (304 is an unusual response, but doesn't seem to be
an error when I looked it up).  When I hit the template, it's making
the same HTTP request, but I'm getting different results.  Any ideas?

Thanks.

-Colin
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to