Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Django images will not load
#1
I am trying to make a hotel reservation app, but my images will not load. I am using Django and Bootstrap

I have my pictures in a media directory in the main directory of my project (with manage.py, myapp, myproject, venv).

I am pointing to these in settings.py

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
And here is the div where I want the image to display

<div class='p-4 m-4' style="height: 300px; background-color: rgba(255,0,0,0.1);">
<img src="/media/pic1.jpg" alt="Photo 1">
</div>
The image icon is showing in my development browser than an image is coming up, but it is not loading.

Does anyone have any idea why?
Reply


Messages In This Thread
Django images will not load - by pythonpaul32 - May-08-2023, 02:39 AM
RE: Django images will not load - by SpongeB0B - Jul-11-2023, 04:57 PM
RE: Django images will not load - by mactron - Jul-15-2023, 01:10 PM
RE: Django images will not load - by Gaurav_Kumar - Jul-20-2023, 10:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fetching Images from DB in Django Dexty 2 1,954 Mar-15-2024, 08:43 AM
Last Post: firn100
  display local images on django website mp3909 2 6,513 Apr-01-2020, 11:18 AM
Last Post: mp3909
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,529 Jun-30-2019, 12:21 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020