In django templates, it\'s common to do the following:
How would you accomplish this in a
Where is your css file served from? This usually isn't a problem as a common media structure such as:
media/
images/
css/
js/
(or similar) allows for relative file paths for images, eg:
background: url('../images/foo.png');
If you're not prepared to change your media folder structure to accommodate relative file paths, you may have no alternative but to overwrite css declarations from within the template, using a secondary css file when offline:
{% if DEBUG %}
<link rel="stylesheet" href="{{ MEDIA_URL }}css/offline-mode.css" />
{% endif %}
Of course the first option is much tidier.
Is using relative paths (for image files) in your CSS files not a viable option for you?
Sorry, you won't like the answer.
I've got the same problem:
There is no easy way to do this with static-served CSS files.
What I do:
I then go to production and do an svn update & touch the WSGI file & validate
If you want to use template directives in a file, why isn't it served via a template?