[Answered ]-Background url–image path

1👍

You probably don’t need to include ${ STATIC_URL } in your image URL.
According to the CSS spec, the path in url() are relative to the stylesheet.

You could probably use something like:

.featurette1 {
  height: 62px
  width:1030px;
  margin: 100px 0; /* Space out the Bootstrap <hr> more */
  background-image: url("../images/apple.png");
  background-repeat:no-repeat;
} 

1👍

Maybe you should check your project’s settings.py and add this:

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "static"),
    '/path/to/project/static/',
)

Then in your template(.html file) try adding:

{% load staticfiles %}
<link href="{% static "base_app/styles/bootstrap.css" %}" rel="stylesheet">

Also in your css you don’t need to use STATIC_URL just try:

background-image: url("base_app/images/apple.png");

Finally I think the tutorial on the django website would help you a lot! Have a look at it!

Leave a comment