My media which i have uploaded using the form in this question View does not seem to be saving all the information in my model is being uploaded to the correct /media/images folder that i have defined. However, on access it returns a 404. i have tried to follow the instructions on https://stackoverflow.com/a/39359264 but still am getting a 404.
my template code
{% for books in object_list %}
<img src="{{ books.cover_pic.url }}">
{% endfor %}
settings.py
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
my urls.py
urlpatterns =[
path('', views.index, name='index'),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
my model code for the image is
cover_pic = models.FileField(null=True, blank=True, upload_to='images/')
my media folder is at base dir (next to manage.py). What am i overlooking?