2006/1/4, iGL <[EMAIL PROTECTED]>:
>
> on windows, MEDIA_URL and MEDIA_ROOT, did not quit help; I haven't
> understood why...

MEDIA_URL is used for file or image upload.
>
> all I did then was to put:
>
> in urls something like
> r'^m/(?P<path>.*)$', 'media', {'document_root':
> 'D:\\django\\testapp\\media\\'}),
>
> and in views
>
> from django.views.static import serve
>
> media = serve
>
> and in the base template:
>
> <link rel="stylesheet" type="text/css"
> href="http://localhost:8000/m/myst2.css"; />
>
> awfully hardcoded, though... :(
>
>
There are two state in django:

1. development
2. Apache(or some other web server)

Django has said that it doesn't serve static files(in static_files
document), so if you want to use built-in static files service, you
should setup in urls.py just like:

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

STATIC_PATH is absolute path. If you done that, you could use it in
links just like:

<image src="/site_media/logo.gif"/>

If you want to serve static files in Apache, you could see the
mod_python document, and just configure like that:

    Alias /site_media d:/project/svn/limodou/django-stepbystep/newtest/media
    <Location "/site_media">
        SetHandler None
    </Location>

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

Reply via email to