I have Pillow installed, Django 2.1 and a model with an ImageField field that places the loaded images in the "images" directory.
In the form from the administrator I can load the image and it is stored in that directory (/ media / images), but when I try to load (or click the link) in the browser the url that the image points to, I it shows in this one the error message "Page not Found", in summary, that this link is not valid or it does not let me load for some reason.
Since the view does not show me the image with:
{{ object.image.url }}
when inspecting the html it shows the route but it does not load the image and it always shows the message ALT.
The static files (in this case images) that I have in the application, if I can show them using
{% static "/ruta/imagen.jpg" %}
But I need to show the loaded images without putting static routes in this way.
Any suggestions will be appreciated.
EDITED + ADDEDWhat I have about it in settings.py
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'media')
]
MEDIA_URL = '/media/'
MEDIA_DIR = os.path.join(BASE_DIR, 'media/')
MEDIA_ROOT = MEDIA_DIR