Nicolas Steinmetz a écrit :

> Jean-Luc wrote:
>
> > igor Guerrero a écrit :
> >
> >> Django dont serve media files, that is the job of the production server
> >> but if yo are using the development server: you can try this:
> >>
> >> http://www.djangoproject.com/documentation/static_files/
>
> Based on above doc, I had same trouble as you Jean Luc but managed to
> succeed, here is the key :
>
> All my django projects are in /home/django so I have /home/django/myproject.
> If you create a directory site_media within this one you should add in
> urls.py :
>
> (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
> {'document_root': '/home/django/myproject/site_media', 'show_indexes':
> True}),
>
> Then, in your template, you'll have :
>
> <link rel="stylesheet" href="/site_media/css/style.css" type="text/css"
> media="screen" />
>
> ... if your css file is /home/django/myproject/site_media/css/style.css
>
> HTH,
> Nicolas


This is working !

I used media in place of site_media for directory name
It seems media shouldn't be used ?

in base.html, for css style sheet
  <link rel="stylesheet" href="/site_media/css/budget.css"
title="main.css" type="text/css" media="screen"/>

for images (in templates or base)
  <a href="/histo/liste"><img alt="Archives" border="0" height="48"
src="/site_media/images/Tux Mammouth 256x256.png?1157920176"
title="Archives" width="48" /></a>&nbsp;Archives &#133

in urls.py
        (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': 'E:/applis/budget/site_media'}),

in unix form
and not windows form : "E:\\applis\\budget\\site_media" or
"E:\applis\budget\site_media"

Thanks Nicolas
jlT


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