I Just add a "site_media" path to urls.py

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

Add to settings.py:

*MEDIA_URL = '/site_media/'*

and then:

*<img src="/site_media/img/pic.png" alt="pic" />*
*
*
*
*

On 8 March 2010 12:05, Martin N. <niemeyermar...@yahoo.com> wrote:

> I encountered problems when I try to adopt HTML page layouts into
> django templates.
>
> These HTML files often reference their CSS files like
> <link rel="stylesheet" href="../css/base.css">
> or
> <link rel="stylesheet" href="base.css">
> because they expect these files (and images, javascript, ...) in a
> location relative to the current HTML document.
>
> Can I use such HTML and CSS in django without searching them for each
> and every link to static content and change it to something like
> <link rel="stylesheet" href="http://myserver.com/media/css/base.css";>?
> The relative links in the above example don't work for me in django
> templates. Absolute links are a nuisance when the templates are used
> on different hostnames and when CSS files must be included from a
> number of subdirectories.
>
> What is the easiest solution?
>
> Thanks
> Martin
>
> --
> 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.
>
>


-- 
Cumprimentos,
Carlos Ricardo Santos

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