[Answered ]-Django database stored images showing only text descriptions

1👍

These are normally media urls, so you render these with:

<img class="gallery" src="{{ image.image.url }}" alt="{{image.description}}">

You need to add the views regarding media files to the urlpatterns, as described in the documentation.

or if these really only contain a path relative to the static folder, you work with:

<img class="gallery" src="{% static image.image.url %}" alt="{{image.description}}">

But it is not very likely that this is the case.

Regardless what the Note that Django only serves static/media files in debug mode (DEBUG = True). If you run this on production, you will need to configure apache/nginx/… to serve static/media files.

Leave a comment