I use a STATIC variable in templates which i set in settings.py which points to the appropriate server or path. So the link is <link rel="stylesheet" href="((STATIC}}/css/base.css"/> and STATIC is something like STATIC="192.168.1.5:8001" Of course i use lighttpd for static files
On Mon, Mar 8, 2010 at 10:05 PM, 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. > > -- "The UNIX system has a command, nice ... in order to be nice to the other users. Nobody ever uses it." - Andrew S. Tanenbaum -- 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.