Skip to content
Advertisement

Django 2.2 img’s not loading

I’m actually new to django and I found a problem when loading my images, I did the settings like the docs said and it saves my images to the right folder. Just the loading part does not work as I want it to.

JavaScript

the upload is working as expected. Saves all images to the media folder (which is on the applevel) so: media/gallery/name.jpg. running the server doesnt show the image but the source seems fine: http://127.0.0.1:8000/media/gallery/gto.jpg

There seems to be a problem with serving files locally when debugging, but all i could find were for older django versions. Iam using django –version 2.2.

I appreciaty any help

Advertisement

Answer

When you are running django under DEBUG = True, you should also add media urls:

Add this to end of your main urls.py:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement