title: Django media URLs in CSS files
body: <p>In django templates, it's common to do the following:</p>
  
  <pre><code>&lt;img src="{{ MEDIA_URL }}/img/someImage.jpg"&gt;
  </code></pre>
  
  <p>How would you accomplish this in a CSS file which is not served as a template?</p>
  
  <pre><code>.someClass {
      /* can't do this this */
      background: url("{{ MEDIA_URL }}/img/someImage.jpg");        
      /* either this */
      background: url("http://media.domain.com/img/someImage.jpg");
      /* or this */
      background: url("/django_static_media/img/someImage.jpg");
      /* can't do both... what to do? */
  }
  </code></pre>
  
  <p>I need the ability to serve my files either from the media subdomain, or during offline work and serve them directly as a django static view. But CSS files are a problem since they are not processed as templates and I cannot use the <code>MEDIA_URL</code> context variable.</p>
  
  <p>What's the solution?</p>
  
  <p><strong>Edit:</strong> I should note that the problem arises since my static media files are in fact located on a separate media sub-domain, <strike>thus negating the use of relative paths.</strike> Got it, thanks!</p>