Hi David,

I don't anything wrong with what you've typed. I have one suggestion:
use the os.path module from Python to avoid hard-coding the paths to
your project. Inside of settings.py, you could add:

import os
# CURRENT_PATH points to your project's root directory
# (the directory in which your settings.py file resides)
CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)

# points to /path/to/project/media_site/
MEDIA_ROOT = os.path.join(CURRENT_PATH, "media_site")

Then, back in urls.py, import your settings and use:

{ 'document_root' : os.path.join(settings.CURRENT_PATH,
"media_site") })

Just a suggestion to help troubleshoot the issue. The only other
thought I had is to remove the dash from the name of your project;
I've had problems with directories containing dashes in the past, but
don't spend too much time testing that, since I'm not sure why that
would be causing the problem here.

Good luck!



On Oct 14, 7:40 am, David <baer.da...@gmail.com> wrote:
> Hello
> I can't get my css working.
> I readhttp://docs.djangoproject.com/en/dev/howto/static-files/and
> many stack overflow and group entries, and I think I have what
> everybody hast that has it working, yet it doesn't work!
>
> In settings.py:
> MEDIA_ROOT ="/home/myhome/workspaces/django-project/media_site/"
> MEDIA_URL = "/media_site/"
> ADMIN_MEDIA_PREFIX = "/media/"
>
> in the template base.html:
> <head>
>     <title>blabla</title>
>         <link href="/media_site/style.css" rel="stylesheet" type="text/css" /
>
> </head>
>
> in urls.py:
> patterns('',
>      (r'^media_site/(?P<path>.*)$', 'django.views.static.serve',
> {'document_root': settings.MEDIA_ROOT}),
> ...
> )
>
> from the terminal:
> david: media_site$ pwd
> /home/myhome/workspaces/django-project/media_site
> david: media_site$ ls
> style.css
>
> I use the development server. The server outputs:
> [14/Oct/2009 16:27:41] "GET /media_site/style.css HTTP/1.1" 404 2118
>
> Any idea where I did anything wrong? a typo somewhere?
> Any help appreciated!
>
> David
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to