We are hosting our media files on a separate server from our web
server.  We are also using SVN for all of the django files, and the
parent directories for the remote media files will correlate to the
SVN version (i.e. see "media_231" below).  The goal here is to be able
to embed django settings.py global variables into the CSS file, so
that we can control the media url from settings, and have it
dynamically fill the CSS file.

The ideal solution is to have the following line in settings.py:

    MEDIA_HOST = 'http://www.mediaserver.com/media_231'

Then in the CSS file have this:

    background: #333 url({{ MEDIA_HOST }}/images/diag.gif

This obviously doesn't work for a number of reasons, so I made a work
around.  I made a template tag (css_path) that reads in the remote CSS
file, replaces custom variables in the CSS with their values from
settings.py, and writes/returns a new .css file.

    {% load process_css %}
    {% get_css_file %}
    <link rel="stylesheet" type="text/css" href="{{ css_path }}" />

It works, except it seems horribly inefficient.  The problem is *each
time* a page is requested, it would have to do a remote URL Request,
write the new css file, etc.  Has anyone been confronted with this
problem.  Is there an easier solution?

Thanks in advance,

Andy


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