Reputation: 9545
I need to generate css based on client queries. I use the @import url() directive inside some style tags to call a method to produce a text string response of css. I can see the css is generated correctly in firebug, but it doesn't take effect.
If I serve the exact same css from my site media directory use the @import directive everything works fine.
my html header code:
<style type="text/css">
@import url("{{ css_url }}")
/*@import url("/site_media/css/style.css")*/
</style>
my django python code:
string = u'#exampleTextInput{ background-color:#ff0000;}\n'
return HttpResponse(string)
Upvotes: 2
Views: 185
Reputation: 1123500
You probably need to set a Content-Type response header; that'd be my first guess:
string = u'#exampleTextInput{ background-color:#ff0000;}\n'
return HttpResponse(string, content_type='text/css')
Upvotes: 4