I'm using django 1.3 for production and want to use static file's in my CSS and javaScript but it doesn't work , I don't have any problem in my HTML ! how must solve this problem ? I didn't find any solution in django doc .
I use this code for adding static files to my CSS :
{% load static %}
{% get_static_prefix as STATIC_PREFIX %}
#main {
background-image: url("{{ STATIC_PREFIX }}img.png");
}
I'm using this template tag {% load static %} {% get_static_prefix as STATIC_PREFIX %}
in my html and it works fine but I dunno why it doesn't work in CSS !!!
Your CSS files aren't rendered by the Django templating engine, they are just served by your web server, so you can't use the Django template language.
If you really wanted to (and this is an exceptionally bad idea) you could serve you CSS files through Django by creating URLs and views that render the CSS files, allowing you to make use of the template language.