Wednesday, March 30, 2011

Re: staticfile app question

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.


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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment