user216485
user216485

Reputation: 789

with django app, how to link to image in .css file

So normally in a website, I make and in the CSS, I do

 #logo {
     background: url(../images/logo.jpg);
}

however, no since I am using a django project, my image is in

C:\Users\me\Documents\mysite\myapp\static\images

and my .css file is in

C:\Users\me\Documents\mysite\myapp\static\css

in settings.py, my static_root is

STATIC_ROOT = 'C:/Users/me/Documents/mysite/myapp/static'

I tried doing

#logo {
    background: url({{ STATIC_URL }}/images/logo.jpg);
}

but that didn't work. Any idea what I'm doing wrong and how to fix it?

Upvotes: 1

Views: 130

Answers (1)

Gustavo Barbosa
Gustavo Barbosa

Reputation: 1360

Since you have both directories in the same path "static", just do as usual:

#logo {
    background: url(../images/logo.jpg);
}

Upvotes: 3

Related Questions