djangodjango-static

How to refer to static files in my css files?


I have a reference inside my CSS file that refers to a static image:

#logo
{
  background: url('/static/logo.png')
}

This works just fine on my dev machine but not on my production environment since the url should be static.mydomain.com/logo.png. How do I dynamically change the css file according to the STATIC_URL in my settings file?


Solution

  • Use a relative path. Relative to the folder where the css file reside