and1can
and1can

Reputation: 79

Django 1.11 Python 3.6 ImageField 404 Error

enter image description here

Not sure how to display my ImageField in Django. Currently, my images are located in /media/static/ and the paths on my terminal all match up to where the images are locally. How come the images do not display?

index.html

^^ using above code in index.html to display the image.

enter image description here

^^ settings.py

enter image description here

^^ urls.py within the current application

enter image description here

^^ models.py

enter image description here

^^ views.py

Upvotes: 0

Views: 694

Answers (1)

neverwalkaloner
neverwalkaloner

Reputation: 47374

You also need to add MEDIA_URL to your urlpatterns(see docs):

urlpatterns = [
# ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Upvotes: 1

Related Questions