Images are not showing up in the page

45 views
Skip to first unread message

Sahan Srinivas

unread,
Apr 9, 2023, 2:16:28 PM4/9/23
to Django users
Hi Devs,

Images are not showing up in Django. Below is the screenshot

image.png
Below are the screenshots of Settings.py file and urls.py files

settings.py
image.png

urls.py
image.png
home.html: (I have give like this in html file)
image.png
views.py
image.png
Media Images:
image.png

I followed the documentation, stack overflow but, I am still not sure why images are not showing up. Can anyone help me out?

Kind regards,
Sahan

Vishesh Mangla

unread,
Apr 9, 2023, 2:46:44 PM4/9/23
to django...@googlegroups.com
Where's {% static %}?

--
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/CAO3SeezAm3Lbe8JGxoCrZ2DCd74p8gFsxzUUoLa5166t6Dm9Kg%40mail.gmail.com.

Sahan Srinivas

unread,
Apr 9, 2023, 3:34:58 PM4/9/23
to django...@googlegroups.com
Hi,
 
{%  static %} is not required here because image is coming from model.

Mir Junaid

unread,
Apr 9, 2023, 3:45:05 PM4/9/23
to django...@googlegroups.com
The command is {% load static%}

Sahan Srinivas

unread,
Apr 9, 2023, 3:53:59 PM4/9/23
to django...@googlegroups.com
Yeah I gave that, actually that is also not the problem. Not sure what it is

Kind Regards,
Sahan

Kiyavilo Msekwa

unread,
Apr 9, 2023, 5:20:21 PM4/9/23
to django...@googlegroups.com
If you are running it on a live server make sure that media/photos folder is on public_html before you run load %satic% since the access to the domain will look into public_html folder to which Django does not run from.

I had previously encountered similar situation and the solution was to copy the folder into public_html instead

I hope this answer the question.

Regards

Kiyavilo

On 9 Apr 2023, at 22:52, Sahan Srinivas <26s...@gmail.com> wrote:

Yeah I gave that, actually that is also not the problem. Not sure what it is

Kind Regards,
Sahan

On Sun, Apr 9, 2023 at 3:44 PM Mir Junaid <mirjun...@gmail.com> wrote:
The command is {% load static%}

On Sun, 9 Apr, 2023, 11:45 pm Sahan Srinivas, <26s...@gmail.com> wrote:
Hi Devs,

Images are not showing up in Django. Below is the screenshot

<image.png>
Below are the screenshots of Settings.py file and urls.py files

settings.py
<image.png>

urls.py
<image.png>
home.html: (I have give like this in html file)
<image.png>
views.py
<image.png>
Media Images:
<image.png>

I followed the documentation, stack overflow but, I am still not sure why images are not showing up. Can anyone help me out?

Kind regards,
Sahan


--
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/CAO3SeezAm3Lbe8JGxoCrZ2DCd74p8gFsxzUUoLa5166t6Dm9Kg%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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAM%2BpT8z6w2Pjs6Hb_CxrOvoWSNhYe4SoL3RrTpkp7pHEXr2spg%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...@googlegroups.com.

Sahan Srinivas

unread,
Apr 9, 2023, 5:29:14 PM4/9/23
to django...@googlegroups.com
Yeah thanks everyone, the problem is resolved.

Ryan Nowakowski

unread,
Apr 13, 2023, 9:46:30 AM4/13/23
to django...@googlegroups.com
Your images field is capitalized in models but lowercase in your template. Canonically it should be lowercase in your models.

Sahan Srinivas

unread,
Apr 13, 2023, 10:38:55 AM4/13/23
to django...@googlegroups.com
Yeah Ryan thanks for your noticing, I was literally looking back and forth for the solution and found it out.

Kind regards,
Sahan

--
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.
Reply all
Reply to author
Forward
0 new messages