B
B
bkz2017-02-23 09:41:21
css
bkz, 2017-02-23 09:41:21

How to correctly set the path in css to an image on django?

How to correctly set the path in css to the image on django. In css I have this, but it does not load
the background-image image: url {% static 'img/bg_body_top.png' %}
Specify where it can be read. And then I don’t know something.
I'm just learning, so don't criticize the question too much.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Peter, 2017-02-23
@petermzg

css is a static file and therefore does not pass through the parser, which is usually called in the view

return render_to_response('help.xtpl', {}, 
                              context_instance = RequestContext(request))

S
sim3x, 2017-02-23
@sim3x

no one generates css in django
If you need to include a dynamic image from the database, then do inline css directly in the template
In static images in css - write the absolute path

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question