Hi
Create a folder inside ur project as static and keep ur images,css and js files 
into that folder then in your settings.py file define static path. U need to 
run python manage.py collect static command on terminal and then you have to 
link that css file in HTML

Hint: check for Managing static files in official django doc or try stack 
overflow.com you will get example to setup static path
 
 
  On Mon, 24 Aug 2020 at 5:37 pm, MAMADOU KANTE<bkatc...@gmail.com> wrote:   Hi 
Everybody!I am trying to set a background image using the STYLE tag with django 
template as follows: <div class="background-img-wrapper" 
style="background-image: url(images/background1.jpg)"></div>But when I open the 
HTML page and inspect the page I receive an image with width zero. Can anyone 
help?When I use the same syntax on a regular HTML without django templates it 
works.
On Mon, Aug 3, 2020 at 10:02 AM Obodoma Uzondu Vincent <uobodoma...@gmail.com> 
wrote:

Hello your have to follow the direction where you stored your file . Generally, 
in Django you create a static folder then maybe an image files where you store 
the images. You should link the image this way src= "{% static 
'images/imag.png' %}"
On Mon, 3 Aug 2020, 10:06 Yemin Sajid, <yeminsa...@gmail.com> wrote:

This may not work as intended if the CSS files are not rendered using the 
Django template engine. You have to put the style declaration where you'd need 
the image in the <style></style> tag in your template code. From there you can 
use the {% static “images/imag.png” %} syntax.
On Friday, July 31, 2020 at 5:58:48 PM UTC+6 Chander shekhar wrote:

tried this buddy yet it is not working
Regards
Chander Shekhar
(bestcsp)


On Thu, Jul 30, 2020 at 6:11 PM Irfan Khan <irfa...@gmail.com> wrote:

{% static 'imag.jpg' %}   instead of this try
{% static “images/imag.png” %}
On Thu, 30 Jul 2020 at 6:07 PM, Chander shekhar <best...@gmail.com> wrote:

I am unable to fetch images from css file .I have used {% load static %}{% 
static 'imag.jpg' %}buti can't fetch.console is saying image not found.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/554cbaf1-3b94-40b4-a0f1-efe0bd3f24ceo%40googlegroups.com.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users...@googlegroups.com.


To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALKGVio%3DAsCafgcd-zfjBb2of-RWbPaTwwGjf7sXbjstgFdM6Q%40mail.gmail.com.




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f0e45bd1-68ca-405f-a033-c808d6da53d5n%40googlegroups.com.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACsKspkUCWwQdO_nGB%3DoU61X9qta7_8bFoBJODSF5rZNoVhiyQ%40mail.gmail.com.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOUY%2BRry8CUXbtx9QGhXYoU5c8R92gxG3q32%2B7dFpiPTnNgWaQ%40mail.gmail.com.
  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1004603577.4391205.1598272002937%40mail.yahoo.com.

Reply via email to