On Mar 30, 2011, at 4:50 PM, Mike Ramirez wrote:

> On Wednesday, March 30, 2011 04:20:32 pm Shawn Milochik wrote:
>> I have the exact same problem. I hope there is a solution, because
>> good site design often results in image references in the CSS.
> 
> 

I think you guys are over analyzing the problem

You can use relative urls in css

Just look at 
        http://www.djangoproject.com/m/css/base.css

Assuming this layout under STATIC_URL
{{STATIC_URL}}
        css/screen.css
        images/header.gif

Just use a relative path in screen.css
#container-head {
   background: transparent url('../images/header.gif') 50% 0 no-repeat;
}

Jason


> The best one I've come up with and it's far from 'best' is to run a command 
> that edits css templates and spits them out to the directory they should be 
> served on at update time. AFAIK DJango can not process the .css files in the 
> media/static directory on the fly.  
> 
> But you might be able to trick it, just thought about this as I was writing 
> above.  Have a url  in urls.py of a regex that ends in '.css' and direct it 
> to 
> a view that serves your css.  
> 
> something like this:
> 
> url(r'^media/css/(?P<name>[\w-]+)\.css$', 'views.css', name='serve-css'),
> 
> with my views.css just for processing css templates.
> 
> I don't know how hard it would be to implement or how well it would work, I 
> haven't done it. It's a thought of this.
> 
> Mike
> 
> 
> -- 
> I appoint you ambassador to Fantasy Island!!!
> 
> -- 
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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