Hello~Daniel and Sandro.

Thanks very much for your answers!

You are right!

the 'media' directory should be a absolute path !

Now it works! Thanks again and again~

2010/10/18 Sandro Dutra <hexo...@gmail.com>

> 1. settings.py
> [...]
> MEDIA_ROOT = "/absolute/path/to/media/"
> [...]
>
> 2. urls.py
> [...]
> from django.conf import settings
> [...]
> (r"^your-media-dir/(.*)$", "django.views.static.serve", {"document_root":
> settings.MEDIA_ROOT}),
> [...]
>
> 3. your base template
> [...]
> <head>
> <link rel="stylesheet" href="/your-media-dir/your.css" type="text/css" />
> <script type="text/javascript" src="/your-media-dir/js/your.js"></script>
> </head>
> [...]
>
> 2010/10/17 Daniel Roseman <dan...@roseman.org.uk>
>
> On Oct 17, 2:49 pm, Cancer <k.cancer.2...@gmail.com> wrote:
>> > Hello,everyone.
>> >
>> > I want to load the css/js files in my development.
>> >
>> > I write the code follows in my "urls.py" accordding to "How to serve
>> static
>> > files <http://docs.djangoproject.com/en/dev/howto/static-files/>"
>> >
>> >  (r'^yzx_media/(?P<path>.*)$', 'django.views.static.serve',
>> >         {'document_root': '/media'}
>> >
>> > but it doesn't work.
>> >
>> > when I input the url "http://localhost:8000/yzx_media/css/tablednd.css";
>> in
>> > the browser  which show me this message on web page:
>> >
>> > Page not found (404)  Request Method: GET  Request URL:
>> http://localhost:8000/yzx_media/css/tablednd.css
>> >
>> > "/media/css/tablednd.css" does not exist
>> >
>> > I'm sure there is a tablednd.css file in the /media/css/ directory .
>> >
>> > I don't know why ,if I didn't something wrong ? and what can I do to fix
>> it?
>> >
>> > any answers are welcome.
>> >
>> > Thank you!
>> > --
>> > Rita Liang
>>
>> I doubt very much that the 'media' directory is at the root of your
>> filesystem. Maybe you meant
>>     {'document_root': '/home/rita/django/path/to/media'}
>> or something like that?
>> --
>> DR.
>>
>> --
>> 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<django-users%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> 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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Rita Liang

-- 
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.

Reply via email to