Can't get uploads to display in templates


#1

I’ m on the user uploaded images chapter of IC and I’m having trouble getting the uploads to display in the templates, the images are in the media directory and the path in src looks correct but the browser says ‘could not load image’.

I’m using django 2 btw - I suspect this may have somthing to do with it. ;)


#2

That error intrigued me. I did a quick search, do you think Adblock is affecting the images? https://stackoverflow.com/questions/23039437/firefox-says-could-not-load-image-for-some-images-adds-weird-classes-automati Do they show up in the web dev inspector?


#3

I managed to get it working - I added this line to urls:

if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


#4

Thanks for the update! :D